[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 2868199: * lisp/files.el (minibuffer-with-setup-hook): Fix bug#46
From: |
Stefan Monnier |
Subject: |
master 2868199: * lisp/files.el (minibuffer-with-setup-hook): Fix bug#46326 |
Date: |
Fri, 23 Apr 2021 17:21:57 -0400 (EDT) |
branch: master
commit 2868199564fd0319e0d324d075d6f91153931e51
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
* lisp/files.el (minibuffer-with-setup-hook): Fix bug#46326
---
lisp/files.el | 15 ++++++++-------
lisp/subr.el | 8 +++++---
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/lisp/files.el b/lisp/files.el
index 7440c11..ee16abf 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1648,13 +1648,14 @@ rather than FUN itself, to `minibuffer-setup-hook'."
(when (eq (car-safe fun) :append)
(setq append '(t) fun (cadr fun)))
`(let ((,funsym ,fun)
- ,hook)
- (setq ,hook
- (lambda ()
- ;; Clear out this hook so it does not interfere
- ;; with any recursive minibuffer usage.
- (remove-hook 'minibuffer-setup-hook ,hook)
- (funcall ,funsym)))
+ ;; Use a symbol to make sure `add-hook' doesn't waste time
+ ;; in `equal'ity testing (bug#46326).
+ (,hook (make-symbol "minibuffer-setup")))
+ (fset ,hook (lambda ()
+ ;; Clear out this hook so it does not interfere
+ ;; with any recursive minibuffer usage.
+ (remove-hook 'minibuffer-setup-hook ,hook)
+ (funcall ,funsym)))
(unwind-protect
(progn
(add-hook 'minibuffer-setup-hook ,hook ,@append)
diff --git a/lisp/subr.el b/lisp/subr.el
index d9fb404..6589faf 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1918,7 +1918,8 @@ one will be removed."
(when (setq old-fun (car (member function hook-value)))
(setq hook-value (remq old-fun hook-value))))
(when old-fun
- ;; Remove auxiliary depth info to avoid leaks.
+ ;; Remove auxiliary depth info to avoid leaks (bug#46414)
+ ;; and to avoid the list growing too long.
(put hook 'hook--depth-alist
(delq (assq old-fun (get hook 'hook--depth-alist))
(get hook 'hook--depth-alist))))
@@ -5017,7 +5018,8 @@ See also `with-eval-after-load'."
(funcall func)
(let ((lfn load-file-name)
;; Don't use letrec, because equal (in
- ;; add/remove-hook) would get trapped in a cycle.
+ ;; add/remove-hook) would get trapped in a cycle
+ ;; (bug#46326).
(fun (make-symbol "eval-after-load-helper")))
(fset fun (lambda (file)
(when (equal file lfn)
@@ -5606,7 +5608,7 @@ to deactivate this transient map, regardless of
KEEP-PRED."
(remove-hook 'pre-command-hook clearfun)
(when on-exit (funcall on-exit)))))
;; Don't use letrec, because equal (in add/remove-hook) would get trapped
- ;; in a cycle.
+ ;; in a cycle. (bug#46326)
(fset clearfun
(lambda ()
(with-demoted-errors "set-transient-map PCH: %S"
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 2868199: * lisp/files.el (minibuffer-with-setup-hook): Fix bug#46326,
Stefan Monnier <=