From: Amin Bandali Date: Fri, 20 Apr 2018 23:02:09 +0000 (-0400) Subject: optimize and measure emacs startup time, saner indentation for org src blocks X-Git-Url: https://git.shemshak.org/~bandali/configs/commitdiff_plain/6089982a89bcec4c02874f5a2af5cd879a473017?ds=inline;hp=35ea1ba40ebdaff54de627a98d2785058cf74ac1 optimize and measure emacs startup time, saner indentation for org src blocks --- diff --git a/emacs/.gitignore b/emacs/.gitignore new file mode 100644 index 0000000..2de0f3c --- /dev/null +++ b/emacs/.gitignore @@ -0,0 +1,8 @@ +*.elc +/init.el +/auto-save-list/ +/var/ +/elpa/ +/recentf +/smex-items +/network-security.data diff --git a/emacs/init.org b/emacs/init.org index 1801baf..7c74728 100644 --- a/emacs/init.org +++ b/emacs/init.org @@ -41,7 +41,7 @@ file. ** Commentary -#+begin_src emacs-lisp +#+begin_src emacs-lisp :comments none ;;; Commentary: ;; Emacs configuration of Amin Bandali, computer scientist and functional @@ -52,15 +52,53 @@ file. * Config -#+begin_src emacs-lisp +#+begin_src emacs-lisp :comments none ;;; Code: #+end_src -TODO +** Org + +#+begin_src emacs-lisp +(setq org-src-tab-acts-natively t + org-src-preserve-indentation nil + org-edit-src-content-indentation 0) +#+end_src + +** Startup time + +Measure and display startup time. Also, temporarily increase +~gc-cons-threshhold~ during startup to reduce reduce garbage +collection frequency. Taken from [[https://github.com/dieggsy/dotfiles/tree/3d95bc08033920e077855caf545a975eba52d28d/emacs.d#startup-time][here]]. + +#+begin_src emacs-lisp +(defconst aminb/emacs-start-time (current-time)) +(defconst aminb/gc-cons-threshold gc-cons-threshold) +(defconst aminb/gc-cons-percentage gc-cons-percentage) +(defvar aminb/file-name-handler-alist file-name-handler-alist) +(setq gc-cons-threshold 400000000 + gc-cons-percentage 0.6 + file-name-handler-alist nil + ;; sidesteps a bug when profiling with esup + esup-child-profile-require-level 0) +#+end_src + +Reset the variables back to default after init. + +#+begin_src emacs-lisp +(add-hook + 'after-init-hook + `(lambda () + (setq gc-cons-threshold aminb/gc-cons-threshold + gc-cons-percentage aminb/gc-cons-percentage + file-name-handler-alist aminb/file-name-handler-alist) + (let ((elapsed (float-time (time-subtract (current-time) + aminb/emacs-start-time)))) + (message "Loading %s...done (%.3fs) [after-init]" + ,load-file-name elapsed)))) +#+end_src * Footer #+begin_src emacs-lisp :comments none - ;;; init.el ends here #+end_src