From: "Clément Pit-Claudel" <cpitclaudel@gmail.com>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: emacs-devel@gnu.org
Subject: Re: A combination of defmacro, functionp, and quoted lambdas yields different results on consecutive evaluations
Date: Sun, 25 Feb 2018 13:09:51 -0500 [thread overview]
Message-ID: <a4ebf395-c4ff-b9d3-0a4b-6873cd2c0147@gmail.com> (raw)
In-Reply-To: <jwvh8qe8d4c.fsf-monnier+emacs@gnu.org>
On 2018-02-18 13:02, Stefan Monnier wrote:
>> Using C-M-x, or just by putting it in my .emacs.
>
> I guess we could tweak C-M-x to try and make it work as well, but as for
> "just putting it in my .emacs" it should already work (and does work for
> me).
>
> The code to handle it when loading a file is in
> readevalloop_eager_expand_eval (in src/lread.c), and the code to handle
> it for the byte-compiler is in byte-compile-recurse-toplevel (in
> bytecomp.el).
>
> Hmm... looking further I see that it "should" already work.
> There's just a macroexpand-all that gets in the way.
> So the patch below (which I pushed to master) makes it work (at least
> for the non-edebug case).
Thanks, that works! Unfortunately, it looks like I oversimplified the problem, and the the more complete example below is still misbehaved. Sorry for the oversimplification.
Here's a repro closer to the problem we ran into in Flycheck:
* In a new file test-macro.el, write this:
(defmacro mmm (f)
`(function ,f))
(provide 'test-macro)
* In a new file test.el, write this
(with-eval-after-load 'test-macro
(let ((out (mmm (lambda ()))))
(message "with-eval-after-load: %S" out)))
(load (expand-file-name "test-macro.el"))
* In test.el, run M-x eval-buffer; I get the following output:
Loading /tmp/test-macro.el (source)...
with-eval-after-load: #'(lambda nil)
Loading /tmp/test-macro.el (source)...done
* In test.el, run M-x eval-buffer again; I get the output shown below. The printed value changes from #'(lambda nil) to (lambda nil), and the with-eval-after-load message is printed twice during loading, for some reason:
with-eval-after-load: (lambda nil)
Loading /tmp/test-macro.el (source)...
with-eval-after-load: #'(lambda nil)
with-eval-after-load: (lambda nil)
Loading /tmp/test-macro.el (source)...done
I get these results on the latest master.
Thanks for your help!
Clément.
next prev parent reply other threads:[~2018-02-25 18:09 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-17 16:04 A combination of defmacro, functionp, and quoted lambdas yields different results on consecutive evaluations Clément Pit-Claudel
2018-02-17 21:58 ` Stefan Monnier
2018-02-18 15:17 ` Clément Pit-Claudel
2018-02-18 18:02 ` Stefan Monnier
2018-02-25 18:09 ` Clément Pit-Claudel [this message]
2018-02-26 3:18 ` Stefan Monnier
2018-02-26 5:40 ` Clément Pit-Claudel
2018-02-26 13:11 ` Stefan Monnier
2018-02-26 15:20 ` Clément Pit-Claudel
2018-02-26 16:31 ` Stefan Monnier
2018-02-26 16:38 ` Stefan Monnier
2018-02-26 17:08 ` Clément Pit-Claudel
2018-02-26 17:31 ` Stefan Monnier
2018-02-28 14:32 ` Clément Pit-Claudel
2018-02-28 16:02 ` Stefan Monnier
2018-02-26 17:01 ` Clément Pit-Claudel
2018-02-26 17:13 ` Stefan Monnier
2018-02-26 17:32 ` Clément Pit-Claudel
2018-02-26 17:40 ` Clément Pit-Claudel
2018-03-01 0:50 ` Radon Rosborough
2018-02-27 21:35 ` Stefan Monnier
2018-02-28 12:44 ` Michael Heerdegen
2018-02-28 13:31 ` Stefan Monnier
2018-02-28 14:26 ` Clément Pit-Claudel
2018-02-28 23:12 ` Stefan Monnier
2018-02-26 13:13 ` Stefan Monnier
2018-02-26 15:20 ` Clément Pit-Claudel
2018-02-26 16:33 ` Stefan Monnier
2018-02-26 16:37 ` Michael Heerdegen
2018-02-26 17:15 ` Clément Pit-Claudel
2018-02-26 17:38 ` Stefan Monnier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a4ebf395-c4ff-b9d3-0a4b-6873cd2c0147@gmail.com \
--to=cpitclaudel@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@IRO.UMontreal.CA \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.