J. David Boyd wrote:
> PT <[EMAIL PROTECTED]> writes:
>
> > Is it safe? I haven't seen it anywhere stated explicitly.
> >
> > For example, I add a hook function to pre-command-hook or
> > post-command-hook which removes itself from the hook when invoked.
> >
>
> Does it blow up emacs?  If not, then it is probably safe!

At first I thought something similar, but that's not really
a valid way to view the problem.  If something else runs a
hook that would normally execute after the one you are removing
there is a potential for other hooks not to run on that command.
Something like that would not likely manifest itself in a
catastrophic way but could cause unusual behaviors that a
conscientious coder would want to avoid.

This line appears in remove-hook.

(setq hook-value (delete function (copy-sequence hook-value)))

It makes me think that a change to the hook's value will not
be visible to the present execution of the run-hooks command.
So I'd say it appears to be perfectly safe.

_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

Reply via email to