unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* 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

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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).