Subject: bug#74490: 31.0.50; make bootstrap fails

From: Stefan Kangas <[email-masked]>
Date: Sat, 23 Nov 2024 12:15:23 -0500

Stefan Monnier <[email-masked]> writes:

> The problem we're facing shows up only during bootstrap, when we're
> loading `loaddefs.el`, and not in the real dump where we load
> `loaddefs.elc`.
>
> Since we presumably don't make any real use of that regexp (we don't
> visit any Python file) while compiling Emacs, another workaround might
> be to wrap the call to `rx` around something like an `(when (fboundp
> 'rx) ...)`.

That would work, yes.

>>> Stefan, are there any clean ways of using calls to autoloaded macros
>>> in autoloaded defconst or defvar?
>
> Currently our autoloading mechanism doesn't offers any clean way to
> enforce some kind of ordering, sadly.  I guess we could also try
> something like:
>
>     ;;;###autoload
>     (defconst python--auto-mode-alist-regexp
>       (eval-when-compile
>         (require 'rx)
>         (rx (or
>              (seq "." (or "py"
>                           "pth"               ; Python Path Configuration File
>                           "pyi"               ; Python Stub File (PEP 484)
>                           "pyw"))             ; MS-Windows specific extension
>              (seq "/" (or "SConstruct" "SConscript"))) ; SCons Build Files
>             eos)))

I like this alternative slightly better, since it makes it more clear
what is going on.

The first version gives the reader the impression that the variable is
sometimes undefined, or that `rx` could be missing... which it
technically is, but not in the cases a prospective reader would usually
need to worry about.