macros and eval-when

From: Andreas Eder (Andreas.Eder_at_gmx.net)
Date: 11/24/04


Date: Wed, 24 Nov 2004 16:33:40 +0100

Hi,

I have a question concerning the use macros and eval-when situations.

Suppose I have a file in which a define some macros and want to use
them in the same file afterwards.
Then, I have to wrap the definition of the macros with
(eval-when (:compile-toplevel) (defmacro ... ))
Is that right?

But in a lot of code that I've seen, the defmacros are wrapped with
 (eval-when (:compile-toplevel :load-toplevel :execute) ... )

Is there any reason to use :load-toplevel and :execute here ?

Macroexpansion happens before loading and executing, doesn't it?
Where is the fault in my reasoning?

Thanks

Andreas

-- 
Wherever I lay my .emacs, there's my $HOME.


Relevant Pages

  • Re: macros and eval-when
    ... Andreas Eder wrote: ... > I have a question concerning the use macros and eval-when situations. ... instance if the expansion of the macro involves calling a function ...
    (comp.lang.lisp)
  • Re: macros and eval-when
    ... > I have a question concerning the use macros and eval-when situations. ... If a defmacro form appears as a top level form, the compiler must store the macro ... compile time if it is referenced within the file being compiled. ...
    (comp.lang.lisp)
  • Re: A speakable (kind of) SUO-KIF ?
    ... One of my concerns is that the macros that parse the atomic ... Lisp, consider Hemlock or better, Climacs). ... write an emacs in CL, you can define _editor macros_. ...
    (comp.lang.lisp)
  • Re: Great SWT Program
    ... way to do X in the text-mode apps but the GUI lets you do X much more ... library of macros to be shared among documents, ... I can't speak for real vi or emacs, but vim can be run in a sort ... of batch mode in which it's controlled by an external script. ...
    (comp.lang.java.programmer)
  • Re: what do you use your computer for?
    ... Will switch as soon as ... I never used them when I used StarOffice, but I do remember that it had ... I have several macros I use daily. ... I don't generally recommend Emacs to people because there's a learning ...
    (alt.os.linux)