From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.help Subject: Re: Macro Expansion Inconsistency Date: Tue, 16 Dec 2014 18:30:57 -0500 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1418772703 24881 80.91.229.3 (16 Dec 2014 23:31:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 16 Dec 2014 23:31:43 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Dec 17 00:31:36 2014 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 1Y11aZ-0006Fv-5q for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Dec 2014 00:31:35 +0100 Original-Received: from localhost ([::1]:47227 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y11aY-0005Y0-PD for geh-help-gnu-emacs@m.gmane.org; Tue, 16 Dec 2014 18:31:34 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35732) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y11aI-0005Xt-5E for help-gnu-emacs@gnu.org; Tue, 16 Dec 2014 18:31:25 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y11aA-00073m-EN for help-gnu-emacs@gnu.org; Tue, 16 Dec 2014 18:31:18 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:54932) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y11aA-00073d-85 for help-gnu-emacs@gnu.org; Tue, 16 Dec 2014 18:31:10 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Y11a9-00061R-2X for help-gnu-emacs@gnu.org; Wed, 17 Dec 2014 00:31:09 +0100 Original-Received: from 206-248-130-192.dsl.teksavvy.com ([206.248.130.192]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 17 Dec 2014 00:31:09 +0100 Original-Received: from monnier by 206-248-130-192.dsl.teksavvy.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 17 Dec 2014 00:31:09 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 22 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 206-248-130-192.dsl.teksavvy.com User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) Cancel-Lock: sha1:NXM63I/koM7ntTbC2SgKrYqmMLU= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:101614 Archived-At: > (defmacro test (name) > `(let* ((name ',name) > (symbol (intern (concat "some" "-" (symbol-name name))))) > ,symbol)) You have 2 macros here: the one you define (test) and the one you use (backquote). The problem is in the one you *use*. I.e. you can reproduce your problem by running the following: `(let* ((name ',"hello") (symbol (intern (concat "some" "-" (symbol-name "hello"))))) ,symbol)) I.e. the `symbol' variable should be bound in `let' that is executed during the macro expansion whereas you instead return a form that binds it (so this `let' binding of `symbol' would only happen later when the expanded code is executed, which here doesn't happen since you first try to get the value of `symbol' which signal an error since there is no such variable at that time). Stefan