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:
Henrik Lissner 2021-05-05 16:12:35 -04:00
parent df10383a26
commit ff64a9d106
6 changed files with 35 additions and 20 deletions

View file

@ -117,10 +117,10 @@ non-nil."
(when-let (init-p (load! doom-module-init-file doom-private-dir t))
(doom-log "Initializing user config")
(maphash (doom-module-loader doom-module-init-file) doom-modules)
(run-hook-wrapped 'doom-before-init-modules-hook #'doom-try-run-hook)
(run-hook-wrapped 'doom-before-init-modules-hook #'doom-run-hook)
(unless no-config-p
(maphash (doom-module-loader doom-module-config-file) doom-modules)
(run-hook-wrapped 'doom-init-modules-hook #'doom-try-run-hook)
(run-hook-wrapped 'doom-init-modules-hook #'doom-run-hook)
(load! "config" doom-private-dir t)
(load custom-file 'noerror (not doom-debug-mode))))))