* question about permanent-local
@ 2009-06-19 18:49 Drew Adams
2009-06-24 21:18 ` Stefan Monnier
0 siblings, 1 reply; 3+ messages in thread
From: Drew Adams @ 2009-06-19 18:49 UTC (permalink / raw)
To: emacs-devel
`kill-all-local-variables' kills all buffer-local variables, except those that
have property `permanent-local'. Many things call `kill-all-local-variables',
including `with-output-to-temp-buffer'.
Things like `with-output-to-temp-buffer' display temporary buffer content, but
the buffers they use are not necessarily temporary. For example, *Help* display
often uses `with-output-to-temp-buffer'.
Treating buffer content as temporary means at least two things: (1) erasing the
buffer initially, and (2) calling `kill-all-local-variables'.
The content is temporary, but the buffer might typically (like *Help*) continue
to exist. And some variables that are buffer-local to it could conceivably be
most related to something other than the content - the display, for instance.
Sometimes, you might not want some buffer-local variable to be considered
temporary, so you give it a non-nil `permanent-local' property. For example, you
could do that to variables `text-scale-mode-amount' and `face-remapping-alist',
if you wanted the same text-scaling to be retained.
However, just because you might want a particular buffer-local variable to not
be killed in some particular buffer (e.g. *Help*), does not imply that you don't
want it killed in other buffers.
What I'm getting at is this: isn't there a use case for something more
fine-grained that just putting `permanent-local' on the symbol, which inhibits
killing in _all_ buffers?
Precisely because these variables are buffer-local, wouldn't it sometimes be
useful to make them permanent-local on a per-buffer basis? For example, have an
alist or a buffer-name regexp, to control which buffers are affected? (This
would be in addition to using the symbol property, which would have the
permanent-local effect for all buffers, as now.)
Just wondering. I'm not very familiar with using `permanent-local'. Offhand, it
doesn't seem like the ideal tool for something that is buffer-specific. But I
know this way of doing things has been around for a long time, so I (rather than
Emacs) am probably missing something. Education welcome.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: question about permanent-local
2009-06-19 18:49 question about permanent-local Drew Adams
@ 2009-06-24 21:18 ` Stefan Monnier
2009-06-24 22:51 ` Lennart Borgman
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Monnier @ 2009-06-24 21:18 UTC (permalink / raw)
To: Drew Adams; +Cc: emacs-devel
> What I'm getting at is this: isn't there a use case for something more
> fine-grained that just putting `permanent-local' on the symbol, which
> inhibits killing in _all_ buffers?
Yes, there are such use cases, but until now they've been sufficiently
rare that we don't have enough experience to know what alternative might
be useful. There's only one exception: for buffer-local hooks, we have
now refined the permanent-local property so it can apply to specific
entries on a hook rather than the hook as a whole.
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: question about permanent-local
2009-06-24 21:18 ` Stefan Monnier
@ 2009-06-24 22:51 ` Lennart Borgman
0 siblings, 0 replies; 3+ messages in thread
From: Lennart Borgman @ 2009-06-24 22:51 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Drew Adams, emacs-devel
On Wed, Jun 24, 2009 at 11:18 PM, Stefan
Monnier<monnier@iro.umontreal.ca> wrote:
>> What I'm getting at is this: isn't there a use case for something more
>> fine-grained that just putting `permanent-local' on the symbol, which
>> inhibits killing in _all_ buffers?
>
> Yes, there are such use cases, but until now they've been sufficiently
> rare that we don't have enough experience to know what alternative might
> be useful. There's only one exception: for buffer-local hooks, we have
> now refined the permanent-local property so it can apply to specific
> entries on a hook rather than the hook as a whole.
This was added because it was useful for multi major modes (like
mumamo). There are definitely other cases there where more refinements
can be very useful. However I am leaning towards that the long term
solution will include a light weight buffer concept too. That would be
a "buffer without a buffer", it should just hold "local" variables
associated with a major mode in some way. (I wrote "local" because it
will not be exactly equal to buffer local variables.)
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-06-24 22:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-19 18:49 question about permanent-local Drew Adams
2009-06-24 21:18 ` Stefan Monnier
2009-06-24 22:51 ` Lennart Borgman
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.