[Top][All Lists]

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

master b4fabb3: Make `kill-all-local-variables' also remove lambda from

From: Lars Ingebrigtsen
Subject: master b4fabb3: Make `kill-all-local-variables' also remove lambda from hooks
Date: Tue, 20 Jul 2021 10:31:34 -0400 (EDT)

branch: master
commit b4fabb316dfe59c75525cd37eaf87020582a9d12
Author: jakanakaevangeli <jakanakaevangeli@chiru.no>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Make `kill-all-local-variables' also remove lambda from hooks
    * src/buffer.c (reset_buffer_local_variables): Also remove
    non-symbol elements from hook variables (bug#46407).
 etc/NEWS     |  8 ++++++++
 src/buffer.c | 12 ++++++------
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index df09d81..8fa43b8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2830,6 +2830,14 @@ This is to keep the same behavior as Eshell.
 * Incompatible Lisp Changes in Emacs 28.1
+** 'kill-all-local-variables' has changed how it handles non-symbol hooks.
+The function is documented to eliminated all buffer-local bindings
+except variables with a 'permanent-local' property, or hooks that
+have elements with a 'permanent-local-hook' property.  In addition, it
+would also keep lambda expressions in hooks sometimes.  The latter has
+now been changed: The function will now also remove these.
 ** Some floating-point numbers are now handled differently by the Lisp reader.
 In previous versions of Emacs, numbers with a trailing dot and an exponent
 were read as integers and the exponent ignored: 2.e6 was interpreted as the
diff --git a/src/buffer.c b/src/buffer.c
index 335523d..b177c5e 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1084,12 +1084,12 @@ reset_buffer_local_variables (struct buffer *b, bool 
                     for (newlist = Qnil; CONSP (list); list = XCDR (list))
                         Lisp_Object elt = XCAR (list);
-                        /* Preserve element ELT if it's t,
-                           if it is a function with a `permanent-local-hook' 
-                           or if it's not a symbol.  */
-                        if (! SYMBOLP (elt)
-                            || EQ (elt, Qt)
-                            || !NILP (Fget (elt, Qpermanent_local_hook)))
+                        /* Preserve element ELT if it's t, or if it is a
+                           function with a `permanent-local-hook'
+                           property. */
+                        if (EQ (elt, Qt)
+                            || (SYMBOLP (elt)
+                                && !NILP (Fget (elt, Qpermanent_local_hook))))
                           newlist = Fcons (elt, newlist);
                   newlist = Fnreverse (newlist);

reply via email to

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