[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Macro Expansion Inconsistency
From: |
Barry Margolin |
Subject: |
Re: Macro Expansion Inconsistency |
Date: |
Wed, 17 Dec 2014 10:53:48 -0500 |
User-agent: |
MT-NewsWatcher/3.5.3b3 (Intel Mac OS X) |
In article <mailman.16290.1418825041.1147.help-gnu-emacs@gnu.org>,
Alexander Shukaev <haroogan@gmail.com> 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 ***
- Re: Macro Expansion Inconsistency, (continued)
- Re: Macro Expansion Inconsistency, Alexander Shukaev, 2014/12/16
- Re: Macro Expansion Inconsistency, Alexander Shukaev, 2014/12/16
- Re: Macro Expansion Inconsistency, Nicolas Richard, 2014/12/17
- Re: Macro Expansion Inconsistency, Alexander Shukaev, 2014/12/17
- Re: Macro Expansion Inconsistency, Stefan Monnier, 2014/12/17
- Re: Macro Expansion Inconsistency, Alexander Shukaev, 2014/12/17
- Re: Macro Expansion Inconsistency, Nicolas Richard, 2014/12/17
- Re: Macro Expansion Inconsistency, Alexander Shukaev, 2014/12/17
- Re: Macro Expansion Inconsistency, Nicolas Richard, 2014/12/17
- Re: Macro Expansion Inconsistency, Alexander Shukaev, 2014/12/17
- Message not available
- Re: Macro Expansion Inconsistency,
Barry Margolin <=
- Re: Macro Expansion Inconsistency, Alexander Shukaev, 2014/12/17
- Message not available
- Re: Macro Expansion Inconsistency, Rusi, 2014/12/16
- Re: Macro Expansion Inconsistency, Nicolas Richard, 2014/12/17
- Re: Macro Expansion Inconsistency, John Mastro, 2014/12/16
- Message not available
- Re: Macro Expansion Inconsistency, John Mastro, 2014/12/16
- Re: Macro Expansion Inconsistency, John Mastro, 2014/12/16
Re: Macro Expansion Inconsistency, Stefan Monnier, 2014/12/16