unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Lute Kamstra <Lute.Kamstra@cwi.nl>
Cc: emacs-devel@gnu.org
Subject: Re: remove-hook.
Date: Tue, 07 Oct 2003 17:13:02 +0200	[thread overview]
Message-ID: <sgdu16lw075.fsf@occarina.pna.cwi.nl> (raw)
In-Reply-To: <jwv7k3h3xs4.fsf-monnier+emacs/devel@vor.iro.umontreal.ca> (Stefan Monnier's message of "07 Oct 2003 10:59:41 -0400")

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

>>> PS: Admittedly, this doesn't work in Emacs-CVS because the only way this
>>> can work is if we can put "negative" entries on the local side of
>>> a hook to disable an element on the global side.  
>
>> If it doesn't work, the docstring is confusing.
>
> The docstring is still correct: if you pass the LOCAL flag and the hook has
> no local side yet, `remove-hook' will create the local side of the hook.
> It is a necessary first step for remove-hook to work.  Admittedly, it's
> currently a useless step because the necessary second step doesn't
> work anyway.

The docstring is not really correct as remove-hook also removes the
buffer-local binding again:

      ...
      (if (equal hook-value '(t))
	  (kill-local-variable hook)
        ...


>>> I have code to make it work, 
>> I'm curious... can I have a peek?
>
> Can't extract it right now, but it's pretty simple: 
> If there's no local `bar' element to remove, `remove-hook' adds a
> (not bar) element.  When `run-hooks' sees such a (not bar) entry, it
> doesn't run anything, but stuffs `bar' in a list of hooks to inhibit
> when processing the global side of the hook.

And you still have the mechanism where t in the buffer-local value of
a hook is substituted by the functions in the global value?

>> I tend to agree that such a system would get rather complicated.
>> It also seems necessary to keep remove-hook efficient: when I
>> instrumented it, I noticed that it was called twice every
>> keystroke.
>
> I don't see how that calls for efficiency.  It's still tiny compared
> to the time it takes for your keystroke to pass through the layers
> and processing necessary for Emacs to get the event (and you can add
> the time for Emacs to update its display, ...).

I probably haven't developed a good intuition for these kind of speed
things yet.  :-(

  Lute.

  reply	other threads:[~2003-10-07 15:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-07 13:25 remove-hook Lute Kamstra
2003-10-07 13:40 ` remove-hook Luc Teirlinck
2003-10-07 13:42 ` remove-hook Stefan Monnier
2003-10-07 14:00   ` remove-hook Lute Kamstra
2003-10-07 14:59     ` remove-hook Stefan Monnier
2003-10-07 15:13       ` Lute Kamstra [this message]
2003-10-07 15:24         ` remove-hook Stefan Monnier
2003-10-07 22:04         ` remove-hook Luc Teirlinck
2003-10-08  4:52     ` remove-hook Richard Stallman
2003-10-10 14:25       ` remove-hook Lute Kamstra
2003-10-11 17:12         ` remove-hook Richard Stallman
2003-10-08  4:52 ` remove-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=sgdu16lw075.fsf@occarina.pna.cwi.nl \
    --to=lute.kamstra@cwi.nl \
    --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).