emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Rationalising c[ad]\{2,5\}r.


From: Alan Mackenzie
Subject: Re: Rationalising c[ad]\{2,5\}r.
Date: Thu, 12 Mar 2015 08:56:07 +0000
User-agent: Mutt/1.5.23 (2014-03-12)

Hello, Artur.

On Wed, Mar 11, 2015 at 09:52:07PM -0300, Artur Malabarba wrote:
> > Just one thing, though, since `number-sequence' is also defined in
> > subr.el, I'd have to wrap it in `eval-and-compile' to be able to use it
> > in my macros.

> I don't understand. Why is that?

Normally, during byte compilation, the newly compiled defuns and defvars
are simply written to the output file.  They cannot be executed/accessed
until that file.elc is later loaded.

This would be a problem for my macro `gen-cXXr-all', which wants to
_run_ `number-sequence' whilst subr.el is being compiled.  The solution
is `eval-and-compile', which instructs the byte compiler both to write
the compiled `number-sequence' to the output file and to evaluate it, so
that it is available for use later during the compilation.

I don't think this is particularly well described in the Elisp manual,
particularly with the sentence "Most uses of `eval-and-compile' are
fairly sophisticated.", which does sound a little patronising.

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]