From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: exits funnel Newsgroups: gmane.emacs.help Subject: Re: A couple rudimentary elisp questions Date: Tue, 2 Mar 2004 13:40:05 -0800 (PST) Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <20040302214005.64889.qmail@web40508.mail.yahoo.com> References: <87smgtxqcs.fsf@thalassa.informatimago.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1078299613 27886 80.91.224.253 (3 Mar 2004 07:40:13 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 3 Mar 2004 07:40:13 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Mar 03 08:40:05 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1AyQz7-000351-00 for ; Wed, 03 Mar 2004 08:40:05 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1AyQz8-0003gv-Op for geh-help-gnu-emacs@m.gmane.org; Wed, 03 Mar 2004 02:40:06 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1AyHdD-0006m5-DH for help-gnu-emacs@gnu.org; Tue, 02 Mar 2004 16:40:51 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1AyHcZ-0006YU-Di for help-gnu-emacs@gnu.org; Tue, 02 Mar 2004 16:40:44 -0500 Original-Received: from [66.218.78.125] (helo=web40508.mail.yahoo.com) by monty-python.gnu.org with smtp (Exim 4.30) id 1AyHcX-0006Xf-R4 for help-gnu-emacs@gnu.org; Tue, 02 Mar 2004 16:40:09 -0500 Original-Received: from [67.86.87.9] by web40508.mail.yahoo.com via HTTP; Tue, 02 Mar 2004 13:40:05 PST Original-To: help-gnu-emacs@gnu.org In-Reply-To: <87smgtxqcs.fsf@thalassa.informatimago.com> X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.2 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 Xref: main.gmane.org gmane.emacs.help:17399 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:17399 > In emacs lisp there's no multiline comment. You can > use > comment-region / uncomment-region to comment several > lines at once. > > Otherwise you can use this trick: use a multi-line > string as a > comment, like you do for documentation strings: > > (defun my-fun () > " This > is the documentation > string of the function > my-fun that appears > when you ask for the > function documentation > with (describe-function 'my-fun) > or C-h C-f my-fun RET > " > (do-something) > " Here is a ''comment'' > spread on several > lines. > Actually, it's not a > comment, it's a string > that is ''evaluated'' > in the course of this > function, but since > we don't do anything > with it, it's finally > ignored. " > (do-something-else) > (get-result)) > > Of course, since the strings are syntactically > significant, you must > take care where you put them. You can't put them > inside function > argument lists, or inside other data lists. They > eventually get > ignored only in statement lists, inside progn and > equivalent (and not > in a result position!). > > Perhaps a cleaner way to do it would be to defined a > comment macro: > > (defmacro rem (&rest args)) > > (defun my-fun () > " This > is the documentation > string of the function > my-fun that appears > when you ask for the > function documentation > with (describe-function 'my-fun) > or C-h C-f my-fun RET > " > (do-something) > (rem Here we have a "comment" > but it is still scanned > and tokenized. > "So we may still use strings > and use any kind of invalid > token such as . . . :-) > But note that you must still > escape double-quotes such as: \" > ") > (do-something-else) > (get-result)) > > You get two advantages with this rem macro: > > 1- a code walker can find your comments if you > need to process them. > > 2- since the macro generates nothing, the > comment/strings don't > eventually appear in compiled code, and the > execution of > compiled code is strictly equivalent with or > without the (rem ...) > (that could be not the case without the > macro). > It's the notation for a cons cell: > > (cons 'foo 'bar) == (foo . bar) > > Lists are built on cons cells, starting from the > empty list (): > > (cons 'foo ()) == (foo . ()) > == (foo) > > (cons 'bar (cons 'foo ())) == (bar . (foo . ())) > == (bar foo) > > (cons 'baz > (cons 'bar > (cons 'foo ()))) == (baz . (bar . (foo . > ()))) == (baz bar foo) > > > The value assigned to the symbol nil is (), the > empty list, which is > actually a special atom. > The empty list () is NOT a cons: (consp ()) == nil, > (atom ()) == t. Pascal, I just wanted to take a quick moment to thank you for your detailed reply. All of the information was very helpful. -exits __________________________________ Do you Yahoo!? Yahoo! Search - Find what you’re looking for faster http://search.yahoo.com