* bug#17498: 24.4.50; This function has a compiler macro `yes--cmacro'.
@ 2014-05-15 15:05 Leo Liu
2014-05-15 19:43 ` Stefan Monnier
2014-05-16 8:59 ` Nicolas Richard
0 siblings, 2 replies; 7+ messages in thread
From: Leo Liu @ 2014-05-15 15:05 UTC (permalink / raw)
To: 17498
Eval the following code
;;;; BEGIN
(defun yes ()
)
(when nil
(cl-define-compiler-macro yes (&rest _)))
;;;; END
,----[ C-h f yes RET ]
| yes is a Lisp function.
|
| (yes)
|
| This function has a compiler macro `yes--cmacro'.
|
| Not documented.
|
| [back]
`----
how is it possible? the compiler macro is defined at macro expansion
time?
Leo
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#17498: 24.4.50; This function has a compiler macro `yes--cmacro'.
2014-05-15 15:05 bug#17498: 24.4.50; This function has a compiler macro `yes--cmacro' Leo Liu
@ 2014-05-15 19:43 ` Stefan Monnier
2014-05-16 1:28 ` Leo Liu
2014-05-16 8:59 ` Nicolas Richard
1 sibling, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2014-05-15 19:43 UTC (permalink / raw)
To: Leo Liu; +Cc: 17498
> ;;;; BEGIN
> (defun yes ()
> )
> (when nil
> (cl-define-compiler-macro yes (&rest _)))
> ;;;; END
> ,----[ C-h f yes RET ]
> | yes is a Lisp function.
> |
> | (yes)
> |
> | This function has a compiler macro `yes--cmacro'.
> |
> | Not documented.
> |
> | [back]
> `----
> how is it possible? the compiler macro is defined at macro expansion
> time?
Pretty much, yes. That's because the compiler macro is likely to be
needed/useful while compiling the rest of the file (before it gets
loaded).
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#17498: 24.4.50; This function has a compiler macro `yes--cmacro'.
2014-05-15 19:43 ` Stefan Monnier
@ 2014-05-16 1:28 ` Leo Liu
2014-05-16 12:24 ` Stefan Monnier
0 siblings, 1 reply; 7+ messages in thread
From: Leo Liu @ 2014-05-16 1:28 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 17498
On 2014-05-15 15:43 -0400, Stefan Monnier wrote:
> Pretty much, yes. That's because the compiler macro is likely to be
> needed/useful while compiling the rest of the file (before it gets
> loaded).
But this is different from emacs 22 and 23. And it looks
counter-intuitive. I would expect macro expansion not to do much other
than transforming the code passed in. So I am curious is current
behaviour due to the byte-compiler i.e. if we don't do it this way it
won't work?
Thanks,
Leo
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#17498: 24.4.50; This function has a compiler macro `yes--cmacro'.
2014-05-16 1:28 ` Leo Liu
@ 2014-05-16 12:24 ` Stefan Monnier
2014-05-16 18:25 ` Leo Liu
0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier @ 2014-05-16 12:24 UTC (permalink / raw)
To: Leo Liu; +Cc: 17498
> But this is different from emacs 22 and 23. And it looks
> counter-intuitive. I would expect macro expansion not to do much other
> than transforming the code passed in. So I am curious is current
> behaviour due to the byte-compiler i.e. if we don't do it this way it
> won't work?
Well, there's always some other way, but yes it's made so that it works
when byte-compiling.
Stefan
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#17498: 24.4.50; This function has a compiler macro `yes--cmacro'.
2014-05-15 15:05 bug#17498: 24.4.50; This function has a compiler macro `yes--cmacro' Leo Liu
2014-05-15 19:43 ` Stefan Monnier
@ 2014-05-16 8:59 ` Nicolas Richard
2014-05-16 18:28 ` Leo Liu
1 sibling, 1 reply; 7+ messages in thread
From: Nicolas Richard @ 2014-05-16 8:59 UTC (permalink / raw)
To: Leo Liu; +Cc: 17498
Leo Liu <sdl.web@gmail.com> writes:
> Eval the following code
>
> ;;;; BEGIN
> (defun yes ()
> )
> (when nil
> (cl-define-compiler-macro yes (&rest _)))
> ;;;; END
FWIW (and because it was not obvious to me), it's due to
eval-and-compile:
(when nil
(eval-and-compile (message "foo")))
=> foo is shown in *Messages*
Same with this :
(defmacro bar () '(eval-and-compile (message "foo")))
(when nil (bar))
This case could be "fixed" by optimizing `when' for a nil condition :
(defmacro new-when (cond &rest body)
(declare (indent 1) (debug t))
(and cond
(list 'if cond (cons 'progn body))))
Then
(new-when nil (bar))
doesn't show anything.
--
Nico.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-05-16 18:28 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-15 15:05 bug#17498: 24.4.50; This function has a compiler macro `yes--cmacro' Leo Liu
2014-05-15 19:43 ` Stefan Monnier
2014-05-16 1:28 ` Leo Liu
2014-05-16 12:24 ` Stefan Monnier
2014-05-16 18:25 ` Leo Liu
2014-05-16 8:59 ` Nicolas Richard
2014-05-16 18:28 ` Leo Liu
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.