GNU bug report logs - #62419
28.2; Elisp let-bound buffer-local variable and kill-local-variable

Previous Next

Package: emacs;

Reported by: Matthew Malcomson <hardenedapple <at> gmail.com>

Date: Fri, 24 Mar 2023 13:42:02 UTC

Severity: normal

Found in version 28.2

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Matthew Malcomson <hardenedapple <at> gmail.com>
Cc: 62419 <at> debbugs.gnu.org
Subject: bug#62419: 28.2; Elisp let-bound buffer-local variable and kill-local-variable
Date: Sun, 26 Mar 2023 11:30:43 -0400
> I.e. currently the behaviour of `setq` on automatic	buffer-local variables is:
> 	- Outside `let`, always affect buffer-local (creating if necessary)
> 	- In `let` of global binding, affect global binding.
> 	- In `let` of buffer-local binding, affect buffer-local
> 	- In `let` of buffer-local binding but where buffer-local value has
> been killed, affect global value.
>
> I believe that last condition is strange and the behaviour of `setq` would
> be more understandable without it.

I think the patch below would fix this corner case.


        Stefan


diff --git a/src/eval.c b/src/eval.c
index ef7ca33f834..82ada40b309 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -3364,7 +3364,7 @@ DEFUN ("fetch-bytecode", Ffetch_bytecode, Sfetch_bytecode,
   return object;
 }
 
-/* Return true if SYMBOL currently has a let-binding
+/* Return true if SYMBOL's default currently has a let-binding
    which was made in the buffer that is now current.  */
 
 bool
@@ -3379,6 +3379,7 @@ let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol)
 	struct Lisp_Symbol *let_bound_symbol = XSYMBOL (specpdl_symbol (p));
 	eassert (let_bound_symbol->u.s.redirect != SYMBOL_VARALIAS);
 	if (symbol == let_bound_symbol
+	    && !p->kind == SPECPDL_LET_LOCAL /* bug#62419 */
 	    && EQ (specpdl_where (p), buf))
 	  return 1;
       }





This bug report was last modified 1 year and 311 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.