From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.devel Subject: Re: dotimes-with-progress-reporter doc string lacks SPEC Date: Thu, 06 Jul 2006 23:48:22 +0200 Message-ID: <44AD8526.5040700@student.lu.se> References: <44AD7613.1060805@student.lu.se> <200607070028.12058.pogonyshev@gmx.net> <7dbe73ed0607061437g5c1b59a3o87d6a28cf14c0ac6@mail.gmail.com> 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 1152222523 12327 80.91.229.2 (6 Jul 2006 21:48:43 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 6 Jul 2006 21:48:43 +0000 (UTC) Cc: emacs-devel@gnu.org, Paul Pogonyshev Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jul 06 23:48:41 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 1FybiC-0002h2-Cx for ged-emacs-devel@m.gmane.org; Thu, 06 Jul 2006 23:48:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FybiB-0005JC-W6 for ged-emacs-devel@m.gmane.org; Thu, 06 Jul 2006 17:48:40 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Fybi0-0005In-8E for emacs-devel@gnu.org; Thu, 06 Jul 2006 17:48:28 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Fybhx-0005Hy-GP for emacs-devel@gnu.org; Thu, 06 Jul 2006 17:48:27 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Fybhx-0005Hg-7R for emacs-devel@gnu.org; Thu, 06 Jul 2006 17:48:25 -0400 Original-Received: from [81.228.11.98] (helo=pne-smtpout1-sn1.fre.skanova.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FybiE-0008Ps-2R for emacs-devel@gnu.org; Thu, 06 Jul 2006 17:48:42 -0400 Original-Received: from [192.168.123.121] (83.249.218.244) by pne-smtpout1-sn1.fre.skanova.net (7.2.075) id 44A1364D002206F0; Thu, 6 Jul 2006 23:48:23 +0200 User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) Original-To: Mathias Dahl In-Reply-To: <7dbe73ed0607061437g5c1b59a3o87d6a28cf14c0ac6@mail.gmail.com> 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:56667 Archived-At: Mathias Dahl wrote: >> Well, the same applies to `dotimes'. > > This is interesting. Here is the source for the `dotimes' macro: > > (defmacro dotimes (spec &rest body) > "Loop a certain number of times. > Evaluate BODY with VAR bound to successive integers from 0, inclusive, > to COUNT, exclusive. Then evaluate RESULT to get return value, default > nil. > > \(fn (VAR COUNT [RESULT]) BODY...)" > (let ((temp (make-symbol "--cl-dotimes-temp--"))) > (list 'block nil > (list* 'let (list (list temp (nth 1 spec)) (list (car spec) 0)) > (list* 'while (list '< (car spec) temp) > (append body (list (list 'incf (car spec))))) > (or (cdr (cdr spec)) '(nil)))))) > > It mentiones `spec', which I think Lennart wants to know more about. > > When loaded (or is it compiled?) though (I just made a dummy call to > it), the documentation string says this: > > dotimes is a Lisp macro in `cl-macs'. > (dotimes (VAR COUNT [RESULT]) BODY...) > > Loop a certain number of times. > Evaluate BODY with VAR bound to successive integers from 0, inclusive, > to COUNT, exclusive. Then evaluate RESULT to get return value, default > nil. > > Not mentioning any `spec' at all. > > Anyone care to explain this magic? Hm, thanks. I can see the pattern. Searching elisp Info I found the explanation in "(elisp) Function Documentation": The last line of the documentation string can specify calling conventions different from the actual function arguments. Write text like this: \(fn ARGLIST) ...