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


Message #29 received at 62419 <at> debbugs.gnu.org (full text, mbox):

From: Matthew Malcomson <hardenedapple <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 62419 <at> debbugs.gnu.org
Subject: Re: bug#62419: 28.2; Elisp let-bound buffer-local variable and
 kill-local-variable
Date: Wed, 29 Mar 2023 11:56:32 +0100
Thanks!

Just for the record I’ve been running using essentially this patch (but with !=) since you suggested it and have not had any problems.

FWIW I also think the change to avoid `let` binding `auto-fill-function` in `normal-mode` is good.

Regards,
Matthew

> On 26 Mar 2023, at 16:30, Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:
> 
>> 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 312 days ago.

Previous Next


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