unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: MON KEY <monkey@sandpframing.com>
Cc: emacs-devel@gnu.org
Subject: Re: Proposal: `buffer-offer-save' be made a permanent-local
Date: Sun, 13 Jun 2010 21:00:42 -0400	[thread overview]
Message-ID: <jwvy6eicudg.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <AANLkTin3zUWMKTXgEL04CLu1Oe7AyxVPi-JwHWaM5qpX@mail.gmail.com> (MON KEY's message of "Sun, 13 Jun 2010 20:17:38 -0400")

> IIUC Stefan's rationale for consideration of making
> `buffer-offer-save' permanent-local is that it would ease the burden
> placed on major-modes (and their authors) to set/check for the
> presence of `buffer-offer-save' by making the value a permanent

No.  If buffer-offer-save is bound to a major-mode, then it should not
be permanent-local (i.e. if that variable is permanent-local, then the
major-mode will need to use change-major-mode-hook to kill that var
explicitly).
The uses where buffer-offer-save would need to be permanent-local are
uses where this state is not bound to a major-mode.

AFAICT, all current uses of buffer-offer-save in Emacs are in places
where the major-mode is not expected to change and where, in case it
does change, it doesn't matter much what happens anyway.

> Consideration of following exchange which transpired between RMS and
> Stefan on emacs-devel circa 2003-06-01 as thread:
>  "Re: kill-buffer-hook permanent-local"
> has caused me some doubt as to whether the current proposed change is
> TRT and is in keeping with the rationale for other similar such
> changes in the past:

The exchange explains how making kill-buffer-hook permanent-local is not
too terrible, because specific major-modes can override the permanence
via change-major-mode-hook.  That same argument applies to any variable,
including buffer-offer-save.

> IMHO Emacs is better served moving _away_ from permanent-locals and
> other sorts of heavy-handed globals with an implicit reliance on
> dynamic-scoping and instead seek to find/incorporate first-class
> lexical-scoping solutions which can better accommodate both the user
> and package developers.

While the permanent-local property is global, it doesn't mean that it's
bad in the same sense as a global variable.  More specifically, the fact
that a variable is not permanent-local, is *also* a global property.
And while a permanent-local variable can easily be made non-permanent
via change-major-mode-hook, it is a lot more difficult to reliably make
a non-permanent-local variable permanent.
So your general argument might end up arguing in favor of making all
variables permanent-local.


        Stefan



  parent reply	other threads:[~2010-06-14  1:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-14  0:17 Proposal: `buffer-offer-save' be made a permanent-local MON KEY
2010-06-14  0:59 ` Lennart Borgman
2010-06-14  1:00 ` Stefan Monnier [this message]
2010-06-14  8:48   ` MON KEY
2010-06-14  9:18     ` Lennart Borgman
2010-06-16  7:21       ` MON KEY
2010-06-16 11:39         ` Lennart Borgman
2010-06-16 22:02           ` MON KEY
2010-06-16 23:11             ` Lennart Borgman
2010-06-28  4:39               ` MON KEY
2010-06-14 13:38     ` Stefan Monnier
2010-06-17  4:15   ` Kevin Rodgers
2010-06-17 20:19     ` Stefan Monnier
  -- strict thread matches above, loose matches on Subject: below --
2010-06-17 21:36 MON KEY
2010-06-17 22:25 ` Lennart Borgman
2010-06-18  0:13   ` MON KEY
2010-06-18  0:33     ` Lennart Borgman
2010-06-18  2:53       ` MON KEY
2010-06-19 15:20         ` Lennart Borgman
2010-06-20  5:05           ` MON KEY

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=jwvy6eicudg.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=monkey@sandpframing.com \
    /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).