unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 47025@debbugs.gnu.org, Andrea Corallo <akrl@sdf.org>
Subject: bug#47025: 28.0.50; [feature/native-comp] pcase is preloaded, but not eln-compiled
Date: Wed, 10 Mar 2021 09:02:35 -0500	[thread overview]
Message-ID: <jwvim5zun0n.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <838s6vp32t.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 10 Mar 2021 15:10:02 +0200")

>> (load "emacs-lisp/macroexp")
>> (if (byte-code-function-p (symbol-function 'macroexpand-all))
>>     nil
>>   ;; Since loaddefs is not yet loaded, macroexp's uses of pcase will simply
>>   ;; fail until pcase is explicitly loaded.  This also means that we have to
>>   ;; disable eager macro-expansion while loading pcase.
>>   (let ((macroexp--pending-eager-loads '(skip))) (load "emacs-lisp/pcase"))
>>   ;; Re-load macroexp so as to eagerly macro-expand its uses of pcase.
>>   (let ((max-lisp-eval-depth (* 2 max-lisp-eval-depth)))
>>     (load "emacs-lisp/macroexp")))
>> ====
>> 
>> > need to preload pcase?
>> 
>> I fear I don't have an answer as ATM I don't uderstand why it should be
>> different compared to master.
>
> Stefan, any ideas why this happens on the native-comp branch but not
> on master?

It's probably the `byte-code-function-p` which tries to distinguish the
case where macroexp has not yet been compiled, but on the native branch,
I suspect that (byte-code-function-p (symbol-function 'macroexpand-all))
will return nil when macroexp has been compiled because it's now
a `subrp`.

So we could replace

    (byte-code-function-p (symbol-function 'macroexpand-all))

with

    (or (byte-code-function-p (symbol-function 'macroexpand-all))
        (subrp (symbol-function 'macroexpand-all)))

or with

    (not (consp (symbol-function 'macroexpand-all)))


-- Stefan






  reply	other threads:[~2021-03-10 14:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-09 17:59 bug#47025: 28.0.50; [feature/native-comp] pcase is preloaded, but not eln-compiled Eli Zaretskii
2021-03-09 20:21 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-10 13:10   ` Eli Zaretskii
2021-03-10 14:02     ` Stefan Monnier [this message]
2021-03-10 15:22       ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-10 16:12         ` Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvim5zun0n.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=47025@debbugs.gnu.org \
    --cc=akrl@sdf.org \
    --cc=eliz@gnu.org \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).