fix(lib): infinite recursion in doom-first-*-hook
It's possible for these hooks to be triggered recursively, such as in the case of emojify's "Emoji images not available should I download them now?" prompt (reported upstream). Fix: iqbalansari/emacs-emojify#100
This commit is contained in:
parent
4d24a3f1a7
commit
a6f0bf3123
1 changed files with 4 additions and 1 deletions
|
@ -240,11 +240,13 @@ HOOK-VAR is triggered, it is reset to nil.
|
|||
HOOK-VAR is a quoted hook.
|
||||
TRIGGER-HOOK is a list of quoted hooks and/or sharp-quoted functions."
|
||||
(dolist (hook trigger-hooks)
|
||||
(let ((fn (make-symbol (format "chain-%s-to-%s-h" hook-var hook))))
|
||||
(let ((fn (make-symbol (format "chain-%s-to-%s-h" hook-var hook)))
|
||||
running?)
|
||||
(fset
|
||||
fn (lambda (&rest _)
|
||||
;; Only trigger this after Emacs has initialized.
|
||||
(when (and after-init-time
|
||||
(not running?)
|
||||
(or (daemonp)
|
||||
;; In some cases, hooks may be lexically unset to
|
||||
;; inhibit them during expensive batch operations on
|
||||
|
@ -253,6 +255,7 @@ TRIGGER-HOOK is a list of quoted hooks and/or sharp-quoted functions."
|
|||
;; hook wasn't invoked interactively.
|
||||
(and (boundp hook)
|
||||
(symbol-value hook))))
|
||||
(setq running? t) ; prevent infinite recursion
|
||||
(doom-run-hooks hook-var)
|
||||
(set hook-var nil))))
|
||||
(cond ((daemonp)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue