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

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

bug#6241: Please make buffer-offer-save permanent local


From: Stefan Monnier
Subject: bug#6241: Please make buffer-offer-save permanent local
Date: Thu, 27 May 2010 20:27:57 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> I think that `buffer-offer-save' belongs to the content.  It protect
> the contents from being thrown away by the user of mistake.  And that
> is a very important function, far above major modes need.  Don't you
> think so?

That's the question, indeed.  Note that the question is only relevant
for non-file buffers (since the variable is ignored for file-buffers).

>> Likewise, I imagine there are some immediate corner cases where
>> tramp'd buffers wouldn't appreciate buffer-offer-save being
>> permanent local.

Not sure what you mean by "tramp'd buffers", but AFAICT such buffers
would most likely be file-buffers and are hence unaffected.

I'd tend to agree with Lennart, if for nothing else that it's easier to
circumvent an annoying permanent-local than it is to fake one.
I.e. if a var is permanent-local and you need it to be killed by
kill-all-local-variables, you can do something like:

  (add-hook 'change-major-mode-hook
            (lambda () (kill-local-variable 'foobar)))

whereas if it is not permanent-local and you need it to survive a change
of major-mode, you have to jump through a few more hoops (a
change-major-mode-hook to stash the variable's content somewhere, plus
an after-change-major-mode-hook to reset it after the fact, plus
additional code to handle the case when after-change-major-mode-hook is
not run, ...).

So, now that the question of "should it ideally be permanent-local?" is
resolved, the remaining question is: "what would be the impact of such
a change", which requires examining all uses of the variable and
assessing the effect of the change for each case.


        Stefan





reply via email to

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