Add doom-run-hooks
Produces more helpful (and harder-to-miss) error messages when a hook emits an error. Also advises run-hook when doom-debug-mode is active, so errors in hooks (generally, major mode hooks) don't quietly go unnoticed.
This commit is contained in:
parent
df10383a26
commit
ff64a9d106
6 changed files with 35 additions and 20 deletions
|
@ -82,14 +82,14 @@ Runs `doom-after-reload-hook' afterwards."
|
|||
(mapc #'require (cdr doom-incremental-packages))
|
||||
(doom--if-compile (format "%S sync -e" doom-bin)
|
||||
(let ((doom-reloading-p t))
|
||||
(run-hook-wrapped 'doom-before-reload-hook #'doom-try-run-hook)
|
||||
(doom-run-hooks 'doom-before-reload-hook)
|
||||
(doom-initialize 'force)
|
||||
(with-demoted-errors "PRIVATE CONFIG ERROR: %s"
|
||||
(general-auto-unbind-keys)
|
||||
(unwind-protect
|
||||
(doom-initialize-modules 'force)
|
||||
(general-auto-unbind-keys t)))
|
||||
(run-hook-wrapped 'doom-after-reload-hook #'doom-try-run-hook)
|
||||
(doom-run-hooks 'doom-after-reload-hook)
|
||||
(message "Config successfully reloaded!"))
|
||||
(user-error "Failed to reload your config")))
|
||||
|
||||
|
|
|
@ -77,13 +77,11 @@ symbol and CDR is the value to set it to when `doom-debug-mode' is activated.")
|
|||
emacs -Q -l init.el -f doom-run-all-startup-hooks-h"
|
||||
(setq after-init-time (current-time))
|
||||
(let ((inhibit-startup-hooks nil))
|
||||
(mapc (lambda (hook)
|
||||
(run-hook-wrapped hook #'doom-try-run-hook))
|
||||
'(after-init-hook
|
||||
delayed-warnings-hook
|
||||
emacs-startup-hook
|
||||
tty-setup-hook
|
||||
window-setup-hook))))
|
||||
(doom-run-hooks 'after-init-hook
|
||||
'delayed-warnings-hook
|
||||
'emacs-startup-hook
|
||||
'tty-setup-hook
|
||||
'window-setup-hook)))
|
||||
|
||||
|
||||
;;
|
||||
|
|
|
@ -116,7 +116,7 @@
|
|||
(--run--)
|
||||
(maphash (doom-module-loader doom-module-init-file) doom-modules)
|
||||
(maphash (doom-module-loader doom-module-config-file) doom-modules)
|
||||
(run-hook-wrapped 'doom-init-modules-hook #'doom-try-run-hook)))
|
||||
(doom-run-hooks 'doom-init-modules-hook)))
|
||||
(`vanilla-doom ; only Doom core
|
||||
`(progn
|
||||
(load-file ,(expand-file-name "core.el" doom-core-dir))
|
||||
|
@ -130,7 +130,8 @@
|
|||
(--run--))))
|
||||
;; Then rerun Emacs' startup hooks to simulate a fresh Emacs session,
|
||||
;; because they've already fired.
|
||||
(fset 'doom-try-run-hook #',(symbol-function #'doom-try-run-hook))
|
||||
(fset 'doom-run-hook #',(symbol-function #'doom-run-hook))
|
||||
(fset 'doom-run-hooks #',(symbol-function #'doom-run-hooks))
|
||||
(fset 'doom-run-all-startup-hooks-h #',(symbol-function #'doom-run-all-startup-hooks-h))
|
||||
(doom-run-all-startup-hooks-h))))))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue