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

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

Re: Why does saving a buffer to a new file clear local variables?


From: Jean Louis
Subject: Re: Why does saving a buffer to a new file clear local variables?
Date: Thu, 12 Dec 2024 15:41:57 +0300
User-agent: Mutt/2.2.12 (2023-09-09)

* Michael Heerdegen via Users list for the GNU Emacs text editor 
<help-gnu-emacs@gnu.org> [2024-12-12 14:33]:
> Jean Louis <bugs@gnu.support> writes:
> 
> > I have just checked it, try doing it this way:
> >
> > (defvar-local abc 123)
> >
> > save the buffer, and verify the abc is still there.
> 
> Are you sure that you don't just see the global binding of that
> variable?

Unless you wish to reveal some new fact about it to me, I see that by
using `defvar-local' I can save file and variable `abc' still has
initially assigned value.

And it has this description:

abc’s value is 123

Not documented as a variable.

  Automatically becomes buffer-local when set.

> > This way, it doesn't work, variable must be symbol, not string:
> > (make-variable-buffer-local "abc")
> 
> Please note that `make-variable-buffer-local' is a function (in contrast
> to `defvar' or `defvar-local' which are macros), so the argument
> (expression) is evaluated and should return a symbol.  When you want to
> specify a symbol quote its name: 'SYMBOL.

That is for original poster. I also said that way it would not work.

-- 
Jean Louis



reply via email to

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