help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: how to temporarily remove a function from a hook?


From: Johan Bockgård
Subject: Re: how to temporarily remove a function from a hook?
Date: Thu, 09 Jul 2009 13:14:41 +0200
User-agent: Gnus/5.110009 (No Gnus v0.9) Emacs/23.0.94 (gnu/linux)

Barry Margolin <barmar@alum.mit.edu> writes:

> Or:
>
> (let ((foo-hook foo-hook))
>   (remove-hook 'bar 'foo-hook)
>   ...)
>
> This doesn't violate the abstraction of remove-hook.

(add-hook 'foo-hook 'global)
(add-hook 'foo-hook 'local nil t)

(list (default-value 'foo-hook)
      foo-hook)
  =>
    ((global) (local t))

(let ((foo-hook foo-hook))
  (remove-hook 'foo-hook 'global))

(list (default-value 'foo-hook)
      foo-hook)
  =>
    (nil (local t))





reply via email to

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