Skip to content

Commit

Permalink
Improve error handling in doom-first-*-hook
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hlissner committed Aug 2, 2020
1 parent c3be741 commit a9bd496
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/core-lib.el
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,10 @@ advised)."
(defmacro add-hook-trigger! (hook-var &rest targets)
"TODO"
`(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)
(dolist (on (list ,@targets))
(if (functionp on)
Expand Down

0 comments on commit a9bd496

Please sign in to comment.