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

2016-01-18 Thread Stefan Monnier
> Does it mean that C-M-x is different than loading? Yes. > Or C-x C-e, for that matter? As well. > Is this covered by the manual? (If not, it might need correcting.) Not really. The basic idea is that macroexpansion can take place *anytime* (tho, before the code is actually executed). If

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

2016-01-18 Thread Marcin Borkowski
On 2016-01-18, at 14:54, Stefan Monnier wrote: >> Does it mean that C-M-x is different than loading? > > Yes. > >> Or C-x C-e, for that matter? > > As well. > >> Is this covered by the manual? (If not, it might need correcting.) > > Not really. The basic idea is that

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

2016-01-18 Thread Stefan Monnier
> Does that mean that it's possible that a function definition contains > unexpanded macros? Yes. > Does that mean that `symbol-function' will expand them? AFAIK it currently never happens there, but if your code relies on this property it's probably got a bug. > Does that mean that if I

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

2016-01-17 Thread Marcin Borkowski
On 2016-01-15, at 11:57, Oleh Krehel wrote: > Marcin Borkowski writes: > >> Why? > > Macro-expand the defun to get: > > (defalias 'print-answer > #'(lambda nil > (message > "The answer is %s." >

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

2016-01-15 Thread Oleh Krehel
Marcin Borkowski writes: > Why? Macro-expand the defun to get: (defalias 'print-answer #'(lambda nil (message "The answer is %s." (forty-two `lambda' is a macro that /quotes/ its body. Therefore, the body of `defun' is not

[O] Why does evaluating a piece of Elisp code seemingly not expand a macro?

2016-01-15 Thread Marcin Borkowski
This piece of code: #+BEGIN_SRC elisp :results value verbatim :exports both (defmacro forty-two () (* 6 7)) (defun print-answer () (message "The answer is %s." (forty-two))) (symbol-function 'print-answer) #+END_SRC yields this: #+RESULTS: : (lambda nil (message "The answer

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

2016-01-15 Thread Samuel W. Flint
> 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

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

2016-01-15 Thread Nick Dokos
swfl...@flintfam.org (Samuel W. Flint) writes: >> 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

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

2016-01-15 Thread Marcin Borkowski
On 2016-01-15, at 22:10, Samuel W. Flint 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