[Top][All Lists]

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

Re: remove-hook.

From: Stefan Monnier
Subject: Re: remove-hook.
Date: 07 Oct 2003 10:59:41 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

>> 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.

>> 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.

> 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, ...).


reply via email to

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