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

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

Re: ~`symbol-function' to get code as list even when byte-compiled?


From: Stefan Monnier
Subject: Re: ~`symbol-function' to get code as list even when byte-compiled?
Date: Tue, 26 May 2015 16:34:14 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

> Perhaps this is a better (safer) way to have it in but
> still out of action. I never contemplated the Boolean

Why have it out of action?  The Right Thing to do is to pass it along to fun:

   (defun add-one-shot-hook (hook fun)
     (let ((name (cl-gensym)))
       (setf (symbol-function name)
             (lambda (&rest args)
               (remove-hook hook name)
               (apply fun args)))
       (add-hook hook name)))


-- Stefan


reply via email to

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