[Top][All Lists]

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

question about permanent-local

From: Drew Adams
Subject: question about permanent-local
Date: Fri, 19 Jun 2009 11:49:24 -0700

`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.

reply via email to

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