mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-03 12:27:26 -05:00
Improve error handling in doom-first-*-hook
This should at least report what function invoked the error. doom-first-input-hook was especially problematic because it runs on pre-command-hook, which Emacs is very protective of. It will smother errors that arise from it and auto-remove the offending hook. This self-correction is nice for avoiding a broken Emacs, but it makes it tough to debug those issues.
This commit is contained in:
@ -490,7 +490,10 @@ advised)."
|
|||||||
(defmacro add-hook-trigger! (hook-var &rest targets)
|
(defmacro add-hook-trigger! (hook-var &rest targets)
|
||||||
"TODO"
|
"TODO"
|
||||||
`(let ((fn (intern (format "%s-h" ,hook-var))))
|
`(let ((fn (intern (format "%s-h" ,hook-var))))
|
||||||
(fset fn (lambda (&rest _) (run-hooks ,hook-var) (set ,hook-var nil)))
|
(fset
|
||||||
|
fn (lambda (&rest _)
|
||||||
|
(run-hook-wrapped ,hook-var #'doom-try-run-hook)
|
||||||
|
(set ,hook-var nil)))
|
||||||
(put ,hook-var 'permanent-local t)
|
(put ,hook-var 'permanent-local t)
|
||||||
(dolist (on (list ,@targets))
|
(dolist (on (list ,@targets))
|
||||||
(if (functionp on)
|
(if (functionp on)
|
||||||
|
Reference in New Issue
Block a user