Commit b4fabb31 authored by jakanakaevangeli's avatar jakanakaevangeli Committed by Lars Ingebrigtsen
Browse files

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).
parent c175ad52
Pipeline #11497 failed with stages
in 1 minute and 9 seconds
...@@ -2829,6 +2829,14 @@ This is to keep the same behavior as Eshell. ...@@ -2829,6 +2829,14 @@ This is to keep the same behavior as Eshell.
* Incompatible Lisp Changes in Emacs 28.1 * 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. ** 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 In previous versions of Emacs, numbers with a trailing dot and an exponent
......
...@@ -1084,12 +1084,12 @@ reset_buffer_local_variables (struct buffer *b, bool permanent_too) ...@@ -1084,12 +1084,12 @@ reset_buffer_local_variables (struct buffer *b, bool permanent_too)
for (newlist = Qnil; CONSP (list); list = XCDR (list)) for (newlist = Qnil; CONSP (list); list = XCDR (list))
{ {
Lisp_Object elt = XCAR (list); Lisp_Object elt = XCAR (list);
/* Preserve element ELT if it's t, /* Preserve element ELT if it's t, or if it is a
if it is a function with a `permanent-local-hook' property, function with a `permanent-local-hook'
or if it's not a symbol. */ property. */
if (! SYMBOLP (elt) if (EQ (elt, Qt)
|| EQ (elt, Qt) || (SYMBOLP (elt)
|| !NILP (Fget (elt, Qpermanent_local_hook))) && !NILP (Fget (elt, Qpermanent_local_hook))))
newlist = Fcons (elt, newlist); newlist = Fcons (elt, newlist);
} }
newlist = Fnreverse (newlist); newlist = Fnreverse (newlist);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment