* Why a defmacro that calls a defun?
@ 2017-10-02 23:26 Eric Abrahamsen
0 siblings, 0 replies; 3+ messages in thread
From: Eric Abrahamsen @ 2017-10-02 23:26 UTC (permalink / raw)
To: help-gnu-emacs
I'm poking through Gnus, and seeing a fair number of places with code
that looks like this:
(defmacro nnoo-define-skeleton (backend)
`(eval-and-compile
(nnoo-define-skeleton-1 ',backend)))
(defun nnoo-define-skeleton-1 (backend)
...)
What does this actually do? All I can see happening is that a quote mark
is added before the BACKEND argument in the macro. What is happening
here?
Thanks,
Eric
^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <mailman.668.1506986797.27995.help-gnu-emacs@gnu.org>]
* Re: Why a defmacro that calls a defun?
[not found] <mailman.668.1506986797.27995.help-gnu-emacs@gnu.org>
@ 2017-10-03 17:24 ` Barry Margolin
2017-10-03 18:20 ` Eric Abrahamsen
0 siblings, 1 reply; 3+ messages in thread
From: Barry Margolin @ 2017-10-03 17:24 UTC (permalink / raw)
To: help-gnu-emacs
In article <mailman.668.1506986797.27995.help-gnu-emacs@gnu.org>,
Eric Abrahamsen <eric@ericabrahamsen.net> wrote:
> I'm poking through Gnus, and seeing a fair number of places with code
> that looks like this:
>
> (defmacro nnoo-define-skeleton (backend)
> `(eval-and-compile
> (nnoo-define-skeleton-1 ',backend)))
>
> (defun nnoo-define-skeleton-1 (backend)
> ...)
>
> What does this actually do? All I can see happening is that a quote mark
> is added before the BACKEND argument in the macro. What is happening
> here?
It just causes the function to be called at compile time as well as run
time, due to the use of eval-and-compile.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Why a defmacro that calls a defun?
2017-10-03 17:24 ` Barry Margolin
@ 2017-10-03 18:20 ` Eric Abrahamsen
0 siblings, 0 replies; 3+ messages in thread
From: Eric Abrahamsen @ 2017-10-03 18:20 UTC (permalink / raw)
To: help-gnu-emacs
Barry Margolin <barmar@alum.mit.edu> writes:
> In article <mailman.668.1506986797.27995.help-gnu-emacs@gnu.org>,
> Eric Abrahamsen <eric@ericabrahamsen.net> wrote:
>
>> I'm poking through Gnus, and seeing a fair number of places with code
>> that looks like this:
>>
>> (defmacro nnoo-define-skeleton (backend)
>> `(eval-and-compile
>> (nnoo-define-skeleton-1 ',backend)))
>>
>> (defun nnoo-define-skeleton-1 (backend)
>> ...)
>>
>> What does this actually do? All I can see happening is that a quote mark
>> is added before the BACKEND argument in the macro. What is happening
>> here?
>
> It just causes the function to be called at compile time as well as run
> time, due to the use of eval-and-compile.
Huh, thanks for that. I guess it's obvious, but it was not clicking for me.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-03 18:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-02 23:26 Why a defmacro that calls a defun? Eric Abrahamsen
[not found] <mailman.668.1506986797.27995.help-gnu-emacs@gnu.org>
2017-10-03 17:24 ` Barry Margolin
2017-10-03 18:20 ` Eric Abrahamsen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.