tweak(lib): log calling hook from doom-run-hook
Makes it easier to trace hooks through logs.
This commit is contained in:
parent
4efaf6837b
commit
1c32e317cc
1 changed files with 4 additions and 1 deletions
|
@ -204,9 +204,11 @@ unreadable. Returns the names of envvars that were changed."
|
||||||
(set-time-zone-rule newtz))))
|
(set-time-zone-rule newtz))))
|
||||||
env))))
|
env))))
|
||||||
|
|
||||||
|
(defvar doom--hook nil)
|
||||||
(defun doom-run-hook (hook)
|
(defun doom-run-hook (hook)
|
||||||
"Run HOOK (a hook function) with better error handling.
|
"Run HOOK (a hook function) with better error handling.
|
||||||
Meant to be used with `run-hook-wrapped'."
|
Meant to be used with `run-hook-wrapped'."
|
||||||
|
(doom-log "hook:%s: run %s" (or doom--hook '*) hook)
|
||||||
(condition-case-unless-debug e
|
(condition-case-unless-debug e
|
||||||
(funcall hook)
|
(funcall hook)
|
||||||
(error
|
(error
|
||||||
|
@ -219,7 +221,8 @@ Meant to be used with `run-hook-wrapped'."
|
||||||
Is used as advice to replace `run-hooks'."
|
Is used as advice to replace `run-hooks'."
|
||||||
(dolist (hook hooks)
|
(dolist (hook hooks)
|
||||||
(condition-case-unless-debug e
|
(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
|
(doom-hook-error
|
||||||
(unless debug-on-error
|
(unless debug-on-error
|
||||||
(lwarn hook :error "Error running hook %S because: %s"
|
(lwarn hook :error "Error running hook %S because: %s"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue