From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: defmacro* usage Date: Wed, 02 Nov 2011 09:04:07 -0400 Message-ID: References: <87ipn2rcer.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1320239076 25567 80.91.229.12 (2 Nov 2011 13:04:36 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 2 Nov 2011 13:04:36 +0000 (UTC) Cc: emacs-devel@gnu.org To: Thierry Volpiatto Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Nov 02 14:04:30 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RLaUX-0002dD-L3 for ged-emacs-devel@m.gmane.org; Wed, 02 Nov 2011 14:04:29 +0100 Original-Received: from localhost ([::1]:41094 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLaUX-000277-70 for ged-emacs-devel@m.gmane.org; Wed, 02 Nov 2011 09:04:29 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:50627) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLaUT-00026m-TM for emacs-devel@gnu.org; Wed, 02 Nov 2011 09:04:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RLaUK-0005Id-VL for emacs-devel@gnu.org; Wed, 02 Nov 2011 09:04:25 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:54962) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLaUK-0005IO-Pe for emacs-devel@gnu.org; Wed, 02 Nov 2011 09:04:16 -0400 Original-Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id pA2D48Pt032600; Wed, 2 Nov 2011 09:04:09 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id DF5AE592E5; Wed, 2 Nov 2011 09:04:07 -0400 (EDT) In-Reply-To: <87ipn2rcer.fsf@gmail.com> (Thierry Volpiatto's message of "Wed, 02 Nov 2011 12:28:44 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.90 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4028=0 X-NAI-Spam-Version: 2.2.0.9286 : core <4028> : streams <697742> : uri <997609> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.22 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:145835 Archived-At: > I have an error with following recipe: > #+BEGIN_SRC lisp > (defmacro* test1 (&key (lang 'french)) > `(case ,lang > (french (message "Bonjour")) > (english (message "Hello")))) [...] > As you can see, the quoted default argument 'french cause an error with > the defmacro* and work fine with the defun*. The error is not from defmacro* but from the code you generated using defmacro*. > Is it a bug or i misunderstand something? A misunderstanding. Think harder about what your macro does. E.g. try (macroexpand '(test1 :lang 'toto)) and (macroexpand '(test1)). During macroexpansion, your `lang' is not supposed to hold a "language value" but "a Lisp expression that will evaluate to a language value". Stefan