From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: ~`symbol-function' to get code as list even when byte-compiled? Date: Tue, 26 May 2015 16:34:14 -0400 Organization: A noiseless patient Spider Message-ID: References: <877frxid14.fsf@debian.uxu> <87twv18i91.fsf@kuiper.lan.informatimago.com> <87wpzw1t8e.fsf@debian.uxu> <87k2vw1rmh.fsf@debian.uxu> <87h9r0b40f.fsf@debian.uxu> <87382k19jm.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1432672526 15222 80.91.229.3 (26 May 2015 20:35:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 26 May 2015 20:35:26 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 26 22:35:21 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YxLZG-00053b-Hr for geh-help-gnu-emacs@m.gmane.org; Tue, 26 May 2015 22:35:18 +0200 Original-Received: from localhost ([::1]:50133 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YxLZF-0003LV-Mx for geh-help-gnu-emacs@m.gmane.org; Tue, 26 May 2015 16:35:17 -0400 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 15 Injection-Info: mx02.eternal-september.org; posting-host="6551a55313eeb1483cdfad32ce9cec6d"; logging-data="9307"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18ynKQm1R0AdE/d7eLI+3pm" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:LyJLROu4Ti1NucFKeSHZbdL5zv4= sha1:UGFjoghDde8YNQq2IKxyKko36y0= Original-Xref: usenet.stanford.edu gnu.emacs.help:212306 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:104590 Archived-At: > 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