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

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

bug#65209: 30.0.50; Unexpected behaviour of setq-local


From: Michael Heerdegen
Subject: bug#65209: 30.0.50; Unexpected behaviour of setq-local
Date: Sun, 13 Aug 2023 06:16:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:

> > > #+begin_src emacs-lisp
> > > (progn
> > >    (defvar my-var :default-value)
> > >    (let ((my-var :let-value))
> > >      (make-local-variable 'my-var)
> > >      (setq my-var :buffer-local-new))
> > >    (list my-var (local-variable-p 'my-var))) ;; (:buffer-local-new t)
> > > #+end_src
> > >
> > > `setq' sets the buffer local binding, not the global value the `let'
> > > binding refers to.

> I guess this bug can be closed, then?  Or is there anything left to
> do?

After thinking more about it:

I could explain the behavior of Gerd's recipes using the manual, but it
doesn't explain the state in my above example _after_ the `let' has
been left.

The manual has a *Warning* section about mixing `let', buffer-local
variables, and changing the current buffer.  But it doesn't explain what
happens in a single buffer when you `let'-bind a (declared) variable,
make it local inside the `let', and finish the `let'.  Is the variable
still buffer-local afterwards, or does `let' remove the
buffer-localness?  With other words, is leaving a `let' the same as a
`setq' to the remembered value, or is it more?

Do we answer that question somewhere?  If not, I suggest to add that,
maybe as an example before the *Warning* section.

Michael.





reply via email to

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