From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Barry Margolin Newsgroups: gmane.emacs.help Subject: Re: Macro Expansion Inconsistency Date: Wed, 17 Dec 2014 10:53:48 -0500 Organization: A noiseless patient Spider Message-ID: References: <87r3vyegmt.fsf@yahoo.fr> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1418831729 10820 80.91.229.3 (17 Dec 2014 15:55:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Dec 2014 15:55:29 +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 16:55:22 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 1Y1Gwb-0000F5-Gs for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Dec 2014 16:55:21 +0100 Original-Received: from localhost ([::1]:50409 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y1Gwb-0008LL-4e for geh-help-gnu-emacs@m.gmane.org; Wed, 17 Dec 2014 10:55:21 -0500 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!barmar.motzarella.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 29 Injection-Info: barmar.motzarella.org; posting-host="2be9e9f5dd9af768b8861af71b85fc28"; logging-data="12286"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+u17ybOF3IjGgWjcyHyyhR" User-Agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) Cancel-Lock: sha1:T9Nn9eh1SFAC3tdh9s/2dSDxVko= Original-Xref: usenet.stanford.edu gnu.emacs.help:209363 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:101642 Archived-At: In article , Alexander Shukaev wrote: > Thank you very much, John and Nicolas. I think I finally understand how > macros expand in Emacs Lisp better now. I'm sure it's not a coincidence > that you both came up with almost identical solutions. It suggests that the > style of returning forms for evaluation from macro is probably the best way > to go in most cases when `let' is involved. Not just "probably the best" -- this is the ONLY way to go in macros. The whole point of macros is to produce new code to be evaluated in place of the original code. The important thing to remember about macros is that they run when you're COMPILING the code, not when you run it. These may be approximately the same time if you evaluate the calling code (e.g. by typing it into the *scratch* buffer, loading the source file, M-x eval-region). This is why calling eval seems to work when you're testing the macro interactively. But if you byte-compile the file, it will be run then, not when you later load the .elc file. This will usually be a totally different Emacs session, so it should be obvious why the results of calling eval won't be available then. -- Barry Margolin, barmar@alum.mit.edu Arlington, MA *** PLEASE post questions in newsgroups, not directly to me ***