mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
tweak(lib): log calling hook from doom-run-hook
Makes it easier to trace hooks through logs.
This commit is contained in:
@ -204,9 +204,11 @@ unreadable. Returns the names of envvars that were changed."
|
||||
(set-time-zone-rule newtz))))
|
||||
env))))
|
||||
|
||||
(defvar doom--hook nil)
|
||||
(defun doom-run-hook (hook)
|
||||
"Run HOOK (a hook function) with better error handling.
|
||||
Meant to be used with `run-hook-wrapped'."
|
||||
(doom-log "hook:%s: run %s" (or doom--hook '*) hook)
|
||||
(condition-case-unless-debug e
|
||||
(funcall hook)
|
||||
(error
|
||||
@ -219,7 +221,8 @@ Meant to be used with `run-hook-wrapped'."
|
||||
Is used as advice to replace `run-hooks'."
|
||||
(dolist (hook hooks)
|
||||
(condition-case-unless-debug e
|
||||
(run-hook-wrapped hook #'doom-run-hook)
|
||||
(let ((doom--hook hook))
|
||||
(run-hook-wrapped hook #'doom-run-hook))
|
||||
(doom-hook-error
|
||||
(unless debug-on-error
|
||||
(lwarn hook :error "Error running hook %S because: %s"
|
||||
|
Reference in New Issue
Block a user