From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Marcin Borkowski Newsgroups: gmane.emacs.help Subject: Evaluation of macro arguments Date: Tue, 05 Jan 2016 11:59:24 +0100 Message-ID: <87fuycs35f.fsf@mbork.pl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1451991604 30524 80.91.229.3 (5 Jan 2016 11:00:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 Jan 2016 11:00:04 +0000 (UTC) To: Help Gnu Emacs mailing list Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jan 05 11:59:58 2016 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 1aGPLH-0002BB-Jf for geh-help-gnu-emacs@m.gmane.org; Tue, 05 Jan 2016 11:59:55 +0100 Original-Received: from localhost ([::1]:48956 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGPLH-00047u-1Q for geh-help-gnu-emacs@m.gmane.org; Tue, 05 Jan 2016 05:59:55 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38738) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGPL6-00047n-Fl for help-gnu-emacs@gnu.org; Tue, 05 Jan 2016 05:59:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aGPL3-0003b6-Ae for help-gnu-emacs@gnu.org; Tue, 05 Jan 2016 05:59:44 -0500 Original-Received: from mail.mojserwer.eu ([2a01:5e00:2:52::8]:37043) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGPL3-0003Ys-39 for help-gnu-emacs@gnu.org; Tue, 05 Jan 2016 05:59:41 -0500 Original-Received: from localhost (localhost [127.0.0.1]) by mail.mojserwer.eu (Postfix) with ESMTP id DE6798F2016 for ; Tue, 5 Jan 2016 11:59:30 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at mail.mojserwer.eu Original-Received: from mail.mojserwer.eu ([127.0.0.1]) by localhost (mail.mojserwer.eu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AnY9OYI6F9xo for ; Tue, 5 Jan 2016 11:59:25 +0100 (CET) Original-Received: from localhost (unknown [109.232.24.28]) by mail.mojserwer.eu (Postfix) with ESMTPSA id 4261B8F200B for ; Tue, 5 Jan 2016 11:59:25 +0100 (CET) User-agent: mu4e 0.9.13; emacs 25.1.50.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2a01:5e00:2:52::8 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:108614 Archived-At: Hi all, continuing my quest to grok macro argument evaluation issues, I'd like (again) to make sure that I get it correctly. So I have this simple macro generating a list of consecutive numbers (which is not without problems - I am aware of those, namely (i) it uses hard-coded symbols instead of generating them on the fly, and (ii) it has no error checking): (defmacro range (from dir to) `(let ((delta (cond ((eq ',dir 'upto) 1) ((eq ',dir 'downto) -1))) (i ,from) (list nil)) (while (not (= i ,to)) (push i list) (setq i (+ i delta))) (nreverse list))) Do I get it correctly that if I want to write an Edebug spec for this macro, I should mark the second argument as _not evaluated_, because its value is actually quoted? (Also, do I get it right that the spec for the second argument should be e.g. `symbolp', or - if I want to have more error-checking while edebugging - I should _define_ a predicate like this (defun upto-or-downto-p (symbol) (memq symbol '(upto downto))) since the predicate in the edebug spec cannot be a lambda expression? TIA, -- Marcin Borkowski http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski Faculty of Mathematics and Computer Science Adam Mickiewicz University