emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 8adc3672ac: (add-hook): Fix regression


From: Stefan Monnier
Subject: master 8adc3672ac: (add-hook): Fix regression
Date: Tue, 22 Feb 2022 22:52:48 -0500 (EST)

branch: master
commit 8adc3672ac1b2fb90d142cfe2a1a74d36e33b41b
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    (add-hook): Fix regression
    
    * lisp/subr.el (add-hook): When the hook has no local part yet, don't
    set `local` to t, so we set the right part of the depth-sym.
    (remove-hook): Don't modify the depth alist by side-effect since I'm
    not completely sure it's safe.
---
 lisp/subr.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/subr.el b/lisp/subr.el
index 1b9b67b705..eb9af0b36d 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1905,7 +1905,9 @@ performance impact when running `add-hook' and 
`remove-hook'."
              (set (make-local-variable hook) (list t)))
     ;; Detect the case where make-local-variable was used on a hook
     ;; and do what we used to do.
-    (unless (and (consp (symbol-value hook)) (memq t (symbol-value hook)))
+    (when (and (local-variable-if-set-p hook)
+               (not (and (consp (symbol-value hook))
+                         (memq t (symbol-value hook)))))
       (setq local t)))
   (let ((hook-value (if local (symbol-value hook) (default-value hook))))
     ;; If the hook value is a single function, turn it into a list.
@@ -2020,7 +2022,7 @@ one will be removed."
           (when di
             (setf (if local (symbol-value depth-sym)
                     (default-value depth-sym))
-                  (delq di depth-alist)))))
+                  (remq di depth-alist)))))
       ;; If the function is on the global hook, we need to shadow it locally
       ;;(when (and local (member function (default-value hook))
       ;;              (not (member (cons 'not function) hook-value)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]