From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.devel Subject: Re: doc on define-minor-mode hook variable(s) Date: Wed, 08 Mar 2006 14:06:06 -0700 Message-ID: References: <87r75gkwbd.fsf-monnier+emacs@gnu.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1141852116 5182 80.91.229.2 (8 Mar 2006 21:08:36 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 8 Mar 2006 21:08:36 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 08 22:08:34 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FH5t9-0004wu-IU for ged-emacs-devel@m.gmane.org; Wed, 08 Mar 2006 22:08:08 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FH5t8-0005mW-Ue for ged-emacs-devel@m.gmane.org; Wed, 08 Mar 2006 16:08:06 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FH5sx-0005hs-5l for emacs-devel@gnu.org; Wed, 08 Mar 2006 16:07:55 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FH5sv-0005dt-JK for emacs-devel@gnu.org; Wed, 08 Mar 2006 16:07:54 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FH5sv-0005dd-7g for emacs-devel@gnu.org; Wed, 08 Mar 2006 16:07:53 -0500 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FH5vp-00077G-Tr for emacs-devel@gnu.org; Wed, 08 Mar 2006 16:10:54 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1FH5se-0004mU-Ar for emacs-devel@gnu.org; Wed, 08 Mar 2006 22:07:36 +0100 Original-Received: from 207.167.42.60 ([207.167.42.60]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 08 Mar 2006 22:07:36 +0100 Original-Received: from ihs_4664 by 207.167.42.60 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 08 Mar 2006 22:07:36 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 40 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 207.167.42.60 User-Agent: Mozilla Thunderbird 0.9 (X11/20041105) X-Accept-Language: en-us, en In-Reply-To: X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:51383 Archived-At: Stefan Monnier wrote: >>>In the past, hook variables were used, and the new notion that a hook need >>>not be associated with a variable should be explained in the doc. > > >>A hook IS a variable--that is to say, a symbol whose value is used. >>It is a mistake to think that a hook is not a variable. > > > Either way it's a mistake: when people think of a hook as a variable, they > think that (boundp 'foo-hook) can tell them whether the hook exists or not. > > So I prefer to think that a hook is its own kind of object, which happens to > be implemented using a variable. (defmacro defhook (symbol &rest optional-args) "Define SYMBOL as a hook. You are not required to define a hook in order to use it, but the definition can supply documentation and an initial value in a way that `\\[describe-variable]' can recognize. INITVALUE is evaluated, and used to set SYMBOL, only if SYMBOL's value is void. If SYMBOL is buffer-local, its default value is what is set; buffer-local values are not affected. INITVALUE and DOCSTRING are optional. If INITVALUE is missing, SYMBOL's value is not set." `(let ((initvalue (car optional-args)) (docstring (cadr optional-args))) (defvar ,symbol ,initvalue ,(if (and docstring (string-match "\\`\\*" docstring)) (substring docstring 1) docstring)) (when (null optional-args) (makunbound ,symbol)))) Just kidding, -- Kevin Rodgers