emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Why does evaluating a piece of Elisp code seemingly not expand a


From: Marcin Borkowski
Subject: Re: [O] Why does evaluating a piece of Elisp code seemingly not expand a macro?
Date: Fri, 15 Jan 2016 23:24:05 +0100
User-agent: mu4e 0.9.13; emacs 25.1.50.1

On 2016-01-15, at 22:10, Samuel W. Flint <address@hidden> wrote:

>>>>>> Marcin Borkowski writes:
>
> MB> This piece of code: #+BEGIN_SRC elisp :results value verbatim
> MB> :exports both (defmacro forty-two () (* 6 7))
>
> That is not a macro.  That's a function.  The return value of a macro
> (the result of the last expression in the implicit progn) needs to be a
> (quasi-)quoted expression.

IIUC, a macro is a function - a function returning a Lisp form.

> This macro simply evaluates to 42.  This should be a function.

Yes, I wanted it to evaluate to 42.  I expected the constant 42 in the
code.  (And this is what happens if I evaluate these forms outside an
Org block.)

> If you want a macro, you could have:
>
> #+BEGIN_SRC: emacs-lisp
>   (defmacro forty-two ()
>             '(* 6 7))
> #+END_SRC
>
> For what you want, you could have it be:
>
> #+BEGIN_SRC: emacs-lisp
>   (defmacro forty-two ()
>             `,(* 6 7))
> #+END_SRC

But this is _not_ what I want!  What I want is to understand the
difference between just C-M-x'ing these forms and evaluating them in
Org-mode.

> Sam

Regards,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



reply via email to

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