From 1e96fed219e58af18bf1a696296af6e041a56fbb Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Sat, 14 May 2022 17:10:14 +0300 Subject: [PATCH] Startup speedup --- .emacs.d/esy.org | 57 +++++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/.emacs.d/esy.org b/.emacs.d/esy.org index 8ed8ce6..e7c6b36 100644 --- a/.emacs.d/esy.org +++ b/.emacs.d/esy.org @@ -5,6 +5,7 @@ #+KEYWORDS: eshel emacs configuration literate babel org elisp #+OPTIONS: ^:{} #+STARTUP: overview indent +#+MACRO: init-time (float-time (time-subtract after-init-time before-init-time)) * Introduction :PROPERTIES: @@ -39,6 +40,16 @@ After the first run of the provided =init.el=, modifications to =esy.org= will be made available automatically whenever Emacs restarts. See also [[#bootstrap][Literate config bootstrap]]. +* Startup time + +I try to keep Emacs lean and fast. One of metric of interest with +regards to Emacs' speed is its /startup/ speed, i.e. how long it takes +between launching Emacs and being able to actually use it. The startup +time of my current Emacs session (in which I am exporting this file) +is *{{{init-time}}}*. + + + * Elisp Header :PROPERTIES: :CUSTOM_ID: header @@ -120,7 +131,7 @@ For further information about Elisp headers, see [[info:elisp#Library graphviz-dot-mode highlight-escape-sequences htmlize ialign keyfreq keycast iedit lin list-unicode-display lorem-ipsum marginalia move-dup no-littering - ns-auto-titlebar ob-prolog orderless org-superstar paredit + ns-auto-titlebar ob-prolog orderless paredit pdf-tools rainbow-delimiters rg smtpmail-multi tramp typit vterm vundo which-key whitespace-cleanup-mode)) @@ -168,17 +179,22 @@ For further information about Elisp headers, see [[info:elisp#Library (require 'recentf) (require 'savehist) (require 'saveplace) - (require 'log-edit) (recentf-mode 1) (savehist-mode 1) (save-place-mode 1) - (setq bookmark-save-flag 1) - (add-to-list 'savehist-additional-variables - 'log-edit-comment-ring)) + (setq bookmark-save-flag 1)) (esy/setup-history) #+end_src +** Persist Git log messages history across emacs sessions + +#+begin_src emacs-lisp + (with-eval-after-load 'log-edit + (add-to-list 'savehist-additional-variables + 'log-edit-comment-ring)) +#+end_src + * Display settings :PROPERTIES: :CUSTOM_ID: display @@ -269,14 +285,15 @@ For a list of available frame parameters, see [[info:elisp#Frame Parameters][eli (defun esy/tangle-and-compile-config () "Tangle literate configuration file." (interactive) - (require 'org) - (require 'ob) - (org-babel-tangle-file esy/source-path - esy/target-path - (rx string-start - (or "emacs-lisp" "elisp") - string-end)) - (byte-compile-file esy/target-path)) + (when (file-newer-than-file-p esy/source-path esy/target-path) + (require 'org) + (require 'ob) + (org-babel-tangle-file esy/source-path + esy/target-path + (rx string-start + (or "emacs-lisp" "elisp") + string-end)) + (byte-compile-file esy/target-path))) (add-hook 'kill-emacs-hook #'esy/tangle-and-compile-config) #+end_src @@ -291,7 +308,6 @@ For a list of available frame parameters, see [[info:elisp#Frame Parameters][eli "Path to my Org mode inbox file.") (with-eval-after-load 'org - (require 'org-superstar) (require 'ob) (require 'ob-prolog) (setq org-agenda-files `(,esy/inbox-path) @@ -314,7 +330,6 @@ For a list of available frame parameters, see [[info:elisp#Frame Parameters][eli org-log-into-drawer t org-use-fast-todo-selection 'expert org-clock-in-switch-to-state "INPROGRESS") - (add-hook 'org-mode-hook #'org-superstar-mode) (keymap-unset org-mode-map "C-," t)) #+end_src @@ -752,7 +767,6 @@ refiling directly into deeper headings as well. (require 'consult) (require 'consult-imenu) (require 'avy) - (require 'dtache) (require 'move-dup) (require 'embark) (keymap-global-unset "s-a") @@ -794,12 +808,10 @@ refiling directly into deeper headings as well. #+begin_src emacs-lisp (defun esy/customize-ctl-x-map () "Configure the `C-x' keymap." - (require 'rg) (keymap-set ctl-x-map "b" #'consult-buffer) (keymap-set ctl-x-4-map "b" #'consult-buffer-other-window) (keymap-set ctl-x-map "!" #'consult-flymake) (keymap-set ctl-x-map "l" #'org-store-link) - (keymap-set ctl-x-map "s" rg-global-map) (keymap-set ctl-x-map "c" #'org-capture) (keymap-set ctl-x-map "o" #'ace-window) (keymap-set ctl-x-map "w" #'esy/eww) @@ -1006,13 +1018,8 @@ does in the shell. :END: #+begin_src emacs-lisp - (defun esy/setup-dtache () - "Setup `dtache'." - (require 'dtache) - (setq dtache-notification-function #'dtache-state-transitionion-echo-message) - (dtache-setup)) - - (add-hook 'after-init-hook #'esy/setup-dtache) + (with-eval-after-load 'dtache + (setq dtache-notification-function #'dtache-state-transitionion-echo-message)) #+end_src * Mode-line customizations -- 2.39.5