feat: add doom-{before,after}-init-hook

doom-before-init-hook runs before $DOOMDIR/init.el is loaded.

doom-after-init-hook runs at the *very* end of the Emacs startup
process (after window-setup-hook).
This commit is contained in:
Henrik Lissner 2022-09-14 19:01:57 +02:00
parent 18cd2eb483
commit 0d7c3eaf24
No known key found for this signature in database
GPG key ID: B60957CA074D39A3
4 changed files with 81 additions and 34 deletions

View file

@ -25,27 +25,22 @@
;; HACK: Load `cl' and site files manually to prevent polluting logs and
;; stdout with deprecation and/or file load messages.
(when noninteractive
(let ((inhibit-message (not init-file-debug)))
(require 'cl nil t)
(unless site-run-file
(let ((site-run-file "site-start")
(tail load-path)
(lispdir (expand-file-name "../lisp" data-directory))
dir)
(while tail
(setq dir (car tail))
(let ((inhibit-message (not init-file-debug)))
(require 'cl nil t)
(unless site-run-file
(let ((site-run-file "site-start")
(tail load-path)
(lispdir (expand-file-name "../lisp" data-directory))
dir)
(while tail
(setq dir (car tail))
(let ((default-directory dir))
(load (expand-file-name "subdirs.el") t inhibit-message t))
(unless (string-prefix-p lispdir dir)
(let ((default-directory dir))
(load (expand-file-name "subdirs.el") t inhibit-message t))
(unless (string-prefix-p lispdir dir)
(let ((default-directory dir))
(load (expand-file-name "leim-list.el") t inhibit-message t)))
(setq tail (cdr tail)))
(load site-run-file t inhibit-message)))))
;; Reset these vars' initial values, in case the site files have changed them.
(dolist (var '(exec-path load-path process-environment))
(put var 'initial-value (default-value var)))
(load (expand-file-name "leim-list.el") t inhibit-message t)))
(setq tail (cdr tail)))
(load site-run-file t inhibit-message))))
(setq-default
;; PERF: Don't generate superfluous files when writing temp buffers.
@ -79,7 +74,9 @@
;; Ensure straight and core packages are ready to go for CLI commands.
;; (require 'doom-profiles)
(require 'doom-modules)
(require 'doom-packages))
(require 'doom-packages)
;; For any last-minute initialization.
(run-hooks 'doom-before-init-hook))
;;