From 084a367183c658fcef734911400c91df0c59df04 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 26 Feb 2021 19:24:19 -0600 Subject: Try to speed up init a bit Shamelessly stole some bits from =use-package=. One day, I may even end up using it again! --- config.org | 51 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 12 deletions(-) (limited to 'config.org') diff --git a/config.org b/config.org index 43096c1..9327758 100644 --- a/config.org +++ b/config.org @@ -339,7 +339,8 @@ someday. Adapted from =midnight-mode=, using suggestions from [[https://old.reddit.com/r/emacs/comments/l6jpxf/how_do_emacs_users_usually_have_multiple_files/gl2249u/][u/ndamee]]. #+begin_src emacs-lisp :noweb-ref packages - (require 'midnight) + (unless (fboundp 'clean-buffer-list) + (autoload #'clean-buffer-list "mightnight")) #+end_src What time I run the clean up is a little tricky for me, since I use @@ -514,7 +515,8 @@ So... function! (straight-use-package '(unicode-fonts :host github :repo "rolandwalker/unicode-fonts")) - (require 'unicode-fonts) + (unless (fboundp 'unicode-fonts-setup) + (autoload #'unicode-fonts-setup "unicode-fonts")) #+end_src According to [[https://github.com/rolandwalker/unicode-fonts/issues/3][Issue #3]], there can be problems with =unicode-fonts-setup= @@ -808,19 +810,42 @@ to /hide/ those contents. #+begin_src emacs-lisp :noweb-ref packages (straight-use-package 'orderless) - (require 'orderless) + (unless (fboundp 'orderless) + (autoload #'orderless "orderless")) #+end_src #+begin_src emacs-lisp :noweb-ref settings - (setq-default - completion-styles '(orderless)) + (setq-default completion-styles '(orderless)) #+end_src *** Consult :package: #+begin_src emacs-lisp :noweb-ref modes (straight-use-package 'consult) - (require 'consult) + (dolist (f '(consult-history + consult-mode-command + consult-complex-command + consult-buffer + consult-buffer-other-window + consult-buffer-other-frame + consult-register + consult-bookmark + consult-line + consult-outline + consult-mark + consult-global-mark + consult-imenu + consult-error + consult-grep + consult-find + consult-line + consult-multi-occur + consult-keep-lines + consult-focus-lines + consult-yank-pop + consult-apropos)) + (unless (fboundp f) + (autoload (function f) "consult"))) #+end_src Consult has a lot of great bindings that work well with Emacs's @@ -847,10 +872,10 @@ default completion system. These all come from the [[https://github.com/minad/c ("M-g i" #'consult-imenu) ("M-g e" #'consult-error) ;; M-s bindings (`search-map') - ("M-s g" #'consult-grep) ; alts: + ("M-s g" #'consult-grep) ; alts: ; consult-git-grep, ; consult-ripgrep - ("M-s f" #'consult-find) ; alts: + ("M-s f" #'consult-find) ; alts: ; consult-locate ("M-s l" #'consult-line) ("M-s m" #'consult-multi-occur) @@ -1070,7 +1095,7 @@ well as the option for some other variables. Since storage is cheap, I keep all of it. #+begin_src emacs-lisp :noweb-ref requires - (require 'savehist) + (run-with-idle-timer 3 nil #'require 'savehist nil t) #+end_src #+begin_src emacs-lisp :noweb-ref modes @@ -1114,7 +1139,7 @@ I also like to keep track of recently-opened files. =recentf= helps with that. #+begin_src emacs-lisp :noweb-ref requires - (require 'recentf) + (run-with-idle-timer 5 nil #'require 'recentf nil t) #+end_src #+begin_src emacs-lisp :noweb-ref settings @@ -2016,7 +2041,8 @@ of (I suppose) generic files. #+begin_src emacs-lisp :noweb-ref packages (straight-use-package 'web-mode) - (require 'web-mode) + (unless (fboundp 'web-mode) + (autoload #'web-mode "web-mode" nil t)) #+end_src #+begin_src emacs-lisp :noweb-ref hooks @@ -2890,7 +2916,8 @@ TODO, and Diary. #+begin_src emacs-lisp :noweb-ref packages (straight-use-package 'org-auto-tangle) - (require 'org-auto-tangle) + (with-eval-after-load 'org + (require 'org-auto-tangle)) #+end_src #+begin_src emacs-lisp :noweb-ref hooks -- cgit 1.4.1-21-gabe81