unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: <emacs-devel@gnu.org>
Subject: question about permanent-local
Date: Fri, 19 Jun 2009 11:49:24 -0700	[thread overview]
Message-ID: <A895264F1CA64CBC84218ACE6E5CBFED@us.oracle.com> (raw)

`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	other threads:[~2009-06-19 18:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-19 18:49 Drew Adams [this message]
2009-06-24 21:18 ` question about permanent-local Stefan Monnier
2009-06-24 22:51   ` Lennart Borgman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=A895264F1CA64CBC84218ACE6E5CBFED@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).