GNU bug report logs - #78995
[PATCH] ;;;autoload-expand for special macros

Previous Next

Package: emacs;

Reported by: JD Smith <jdtsmith <at> gmail.com>

Date: Fri, 11 Jul 2025 19:29:02 UTC

Severity: normal

Tags: patch

Fixed in version 31

Done: "J.D. Smith" <jdtsmith <at> gmail.com>

Full log


View this message in rfc822 format

From: "J.D. Smith" <jdtsmith <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 78995 <at> debbugs.gnu.org, Michael Albinus <michael.albinus <at> gmx.de>
Subject: bug#78995: [PATCH] ;;;autoload-expand for special macros
Date: Sun, 27 Jul 2025 13:59:05 -0400
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

>>> Ah right, my imagining above was not so misguided then.  Maybe the tramp
>>> maintainer will want to expand that simple macro away now.
>>
>> I give this explanation to Stefan, he added this macro to Tramp years
>> ago (commit 07d8827946f9) :-)
>>
>> --8<---------------cut here---------------start------------->8---
>>     Functionally split tramp-loaddefs.el into two parts: one part run
>>     while loading it at the very beginning of loading tramp.el (holding plain
>>     autoloads and declarations), and another run at the very end of loading
>>     tramp.el (holding setup code).
>>     This should reduce infinite-recursion problems while loading.
>> --8<---------------cut here---------------end--------------->8---
>>
>> See also bug#59194, which waits for me understanding what to do.
>
> [ It did look like something I'd seen before but I had no recollection
>   of actually writing it.  ]
>
> Damn!  So now I'm the one who needs to figure out how to keep it working
> in Emacs<31 while trying to make it behave with the new
> "autoload-expand".


Maybe it is as simple as requiring a (new?) file that defines the macro
directly, and whenever you require tramp-loaddefs, using NOERROR=t?

Then in Emacs 31, the first file with an ;;;###autoload followed by
usage of TRAMP's macro will be loaded, causing the macro to be defined.
If you want, you can declare `(autoload-macro expand)' when you define
the macro (I think old Emacs version will just ignore it?). This will
mean:

- In Emacs 31: the macro itself is never mentioned, but the add-hook and
  any other forms are instead copied into tramp-loaddefs.

- In earlier Emacs, the macro and then calls to it are both included in
  tramp-loaddefs, just as they are now.

I think either setup works (though on-demand expansion may be "safer",
since it doesn't depend on load order any more.)




This bug report was last modified 27 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.