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

From: JD Smith <[email-masked]>
Date: Tue, 2 Sep 2025 10:08:29 -0400

> On Sep 2, 2025, at 10:01 AM, Gerd Möllmann <[email-masked]> wrote:
> 
> JD Smith <[email-masked]> writes:
> 
>>> Not sure if that's relevant, don't know what this is all about anyway.
>> 
>> I think the idea is to require 'cl-extra in tramp.el, after 'cl-lib.
>> The issue is we are loading tramp during the build of *-loaddefs.el
>> files, and yet tramp is currently relying (indirectly) on the autoload
>> of cl-subseq from cl-extra.
> 
> I meant more what your original change was for. Anyway, with this
> change
> 
> 1 file changed, 2 insertions(+)
> lisp/net/tramp.el | 2 ++
> 
> modified   lisp/net/tramp.el
> @@ -67,6 +67,8 @@
> (require 'tramp-message)
> (require 'tramp-integration)
> (require 'trampver)
> +(require 'cl-lib)
> +(require 'cl-extra)
> 
> ;; Pacify byte-compiler.
> (require 'cl-lib)
> 
> I get the same errors
> 
> loaddefs-gen: loading file tramp-adb (for tramp--with-startup)
> Loading /Users/gerd/emacs/github/master/lisp/net/tramp-adb.el (source)...
> Warning (emacs): loaddefs-gen: load error
> (error Eager macro-expansion failure: (error "Eager macro-expansion failure: (void-function cl-subseq)"))

I guess I don't understand where this is coming from then.  What if you take out the condition-case and let it generate a backtrace?

modified   lisp/emacs-lisp/loaddefs-gen.el
@@ -235,10 +235,7 @@ loaddefs-generate--make-autoload
                     (member file loaddefs--load-error-files))
           (let ((load-path (cons (file-name-directory file) load-path)))
             (message "loaddefs-gen: loading file %s (for %s)" file car)
-            (condition-case e (load file)
-              (error
-               (push file loaddefs--load-error-files) ; do not attempt again
-               (warn "loaddefs-gen: load error\n\t%s" e)))))
+            (load file)))
         (and (macrop car)
 	     (eq 'expand (function-get car 'autoload-macro))
 	     (setq expand (let ((load-true-file-name file)