mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
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:
@ -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)
|
||||
|
Reference in New Issue
Block a user