Major refactor of Doom bootstrap process

+ New `input` and `buffer` support for :defer in def-package! can now
  defer packages until the first command invoked after startup or first
  interactive buffer switch, respectively
+ Exploit these new :defer techniques to lazy-load many core packages,
  netting Doom a 20-30% decrease in startup time
+ Various userland macros (like package!, def-package-hook!, packages!,
  and disable-packages!) will now throw an error if used incorrectly
  (i.e. outside of their intended files; e.g. package! should be used in
  packages.el files)
+ Removed support for multiple/nested doom! calls. There should only be
  THE ONE in ~/.doom.d/init.el (or ~/.config/doom/init.el)
+ Fix an issue where load-path and auto-mode-list modifications would
  not persist because doom-packages-file was cached too late.
+ Added package-activated-list to cached variables in
  doom-packages-file, thus we no longer need custom-file.
+ Load Doom core files from doom-initialize. Now doom-initialize can be
  called from state-dependent non-interactive functions, instead of
  reloading core/core.el, which was clumsy
+ Removed the doom-post-init-hook hook. There was no reason for it to
  exist when doom-init-hook can simply be appended to
This commit is contained in:
Henrik Lissner 2018-05-14 18:40:35 +02:00
parent bb4a8e98e6
commit bec79a3d4c
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
6 changed files with 268 additions and 229 deletions

View file

@ -280,15 +280,19 @@ DEFAULT is non-nil, set the default mode-line for all buffers."
(add-hook 'isearch-mode-end-hook #'doom|enable-ui-keystrokes)
;; undo/redo changes to Emacs' window layout
(defvar winner-dont-bind-my-keys t) ; I'll bind keys myself
(autoload 'winner-mode "winner" nil t)
(add-hook 'doom-init-ui-hook #'winner-mode)
(def-package! winner
:defer buffer
:preface (defvar winner-dont-bind-my-keys t) ; I'll bind keys myself
:config (winner-mode +1))
;; highlight matching delimiters
(setq show-paren-delay 0.1
show-paren-highlight-openparen t
show-paren-when-point-inside-paren t)
(add-hook 'doom-init-ui-hook #'show-paren-mode)
(def-package! paren
:defer input
:config
(setq show-paren-delay 0.1
show-paren-highlight-openparen t
show-paren-when-point-inside-paren t)
(show-paren-mode +1))
;;; More reliable inter-window border
;; The native border "consumes" a pixel of the fringe on righter-most splits,
@ -352,10 +356,12 @@ from the default."
(prog1 (apply orig-fn args)
(run-hooks 'doom-after-switch-buffer-hook)))
(advice-add #'select-frame :around #'doom*switch-frame-hooks)
(advice-add #'select-window :around #'doom*switch-window-hooks)
(advice-add #'switch-to-buffer :around #'doom*switch-buffer-hooks)
(advice-add #'display-buffer :around #'doom*switch-buffer-hooks)
(defun doom|init-custom-hooks ()
(advice-add #'select-frame :around #'doom*switch-frame-hooks)
(advice-add #'select-window :around #'doom*switch-window-hooks)
(advice-add #'switch-to-buffer :around #'doom*switch-buffer-hooks)
(advice-add #'display-buffer :around #'doom*switch-buffer-hooks))
(add-hook 'doom-init-hook #'doom|init-custom-hooks)
(defun doom*load-theme-hooks (theme &rest _)
(setq doom-theme theme)