unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: rms@gnu.org, emacs-devel@gnu.org
Subject: Re: add-hook
Date: 10 Nov 2003 10:41:28 -0500	[thread overview]
Message-ID: <jwvislsjkt9.fsf-monnier+emacs/devel@vor.iro.umontreal.ca> (raw)
In-Reply-To: <buollqo24n3.fsf@mcspd15.ucom.lsi.nec.co.jp>

> Richard Stallman <rms@gnu.org> writes:
>> ;; Detect the case where make-local-variable was used on a hook
>> ;; and do what we used to do.
>> (unless (and (consp (symbol-value hook)) (memq t (symbol-value hook)))
>> (setq local t)))
>> 
>> That is very confusing, and contradicts what the comment says.
>> This needs to be cleaned up somehow.

> Call me insane, but wouldn't `local-variable-p' be a nice way to detect
> this case...?

Well, that's what RMS thought and so he added it and it breaks things:
Setting `local' to t ensures that the var will be modified with `set'
whereas a setting of nil implies that the hook will be modified with
`set-default', so the safe setting is t.  The only case where we
want to use the unsafe setting of nil is when we indeed want to change
the global part of the hook and there is both a local and a global part
(i.e when local == nil and when there's a t in the hook's content).

You can add an unnecessary test for local-variable-if-set-p, or you can
change the comment to make things more clear, but you can't use
local-variable-p: we tried that already.


        Stefan

  reply	other threads:[~2003-11-10 15:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-10  3:01 add-hook Richard Stallman
2003-11-10  5:07 ` add-hook Miles Bader
2003-11-10 15:41   ` Stefan Monnier [this message]
2003-11-11  2:26     ` add-hook Miles Bader
2003-11-12 20:02       ` add-hook Richard Stallman
2003-11-11 18:22   ` add-hook Richard Stallman

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=jwvislsjkt9.fsf-monnier+emacs/devel@vor.iro.umontreal.ca \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=rms@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).