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:
parent
c3be74139a
commit
a9bd4965bf
1 changed files with 4 additions and 1 deletions
|
@ -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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue