bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#62419: 28.2; Elisp let-bound buffer-local variable and kill-local-va


From: Stefan Monnier
Subject: bug#62419: 28.2; Elisp let-bound buffer-local variable and kill-local-variable
Date: Sun, 26 Mar 2023 11:30:43 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

> 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;
       }






reply via email to

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