Subject: bug#79353: 31.0.50; Eager macro expansion errors when building master

From: Gerd Möllmann <[email-masked]>
Date: Thu, 04 Sep 2025 09:03:06 +0200

Stefan Monnier <[email-masked]> writes:

>> It currently doesn't function due to the load error.  We could of course
>> just catch and not report load errors. But they do provide insight into
>> early-loading issues that may merit correction.  And this "silent approach"
>
> Yes, we should address the warning rather than mute all those warnings.
>
>> I do think a real question could be asked: how early should it be possible
>> to load a valid lisp file?
>
> That one's easy: the whole of `loadup.el` is made of a delicate
> ordering, so it's only after those files have been loaded that you're in
> safe territory.
>
> So, I guess this suggests we should build the \N{...} table before we
> build the `loaddefs.el` and that should be doable without any new
> bootstrap issue since we have `ldefs-boot.el` to solve that dependency.

Put some sturdy footwear on for the Makefile shrubbery, and came up with
the attached patch. It's for my Emacs only; I have no way of testing
this with all the other platforms, and all the ways Emacs can be built.
And I'm not sure that you would want the loaddefs-gen change either. And
blahblah :-).

>From a1c6a6001d6230c7c82dfc27dca9f2eb2d7737ea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gerd=20M=C3=B6llmann?= <[email-masked]>
Date: Thu, 4 Sep 2025 08:51:19 +0200
Subject: [PATCH] Fix autoload generation (bug#79353)

* src/Makefile.in ($(lispsource)/loaddefs.el): Depend on
$(lispsource)/international/charprop.el.
* lisp/emacs-lisp/loaddefs-gen.el (generate-lisp-file): Require
cl-lib and cl-extra.
---
 lisp/emacs-lisp/loaddefs-gen.el | 2 ++
 src/Makefile.in                 | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el
index 9e91a11204d..8063283902f 100644
--- a/lisp/emacs-lisp/loaddefs-gen.el
+++ b/lisp/emacs-lisp/loaddefs-gen.el
@@ -42,6 +42,8 @@
 (require 'radix-tree)
 (require 'lisp-mnt)
 (require 'generate-lisp-file)
+(require 'cl-lib)
+(require 'cl-extra)
 
 (defvar autoload-compute-prefixes t
   "If non-nil, autoload will add code to register the prefixes used in a file.
diff --git a/src/Makefile.in b/src/Makefile.in
index d867b53797b..3524394f7d9 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1004,7 +1004,8 @@ ../native-lisp:
 endif
 
 ifneq ($(XCONFIGURE),android)
-$(lispsource)/loaddefs.el: | bootstrap-emacs$(EXEEXT) $(bootstrap_pdmp)
+$(lispsource)/loaddefs.el: $(lispsource)/international/charprop.el | \
+		bootstrap-emacs$(EXEEXT) $(bootstrap_pdmp)
 	$(MAKE) -C ../lisp autoloads EMACS="$(bootstrap_exe)"
 endif
 
-- 
2.51.0