Subject: bug#78995: [PATCH] ;;;autoload-expand for special macros

From: Stefan Monnier <[email-masked]>
Date: Sat, 12 Jul 2025 12:09:55 -0400

> This makes it challenging to wrap things like `define-minor-mode' into a new
> macro, and autoload the resulting forms.  This small patch adds a new
> variant of the autoload cookie:
>
> ;;;autoload-expand
> (my-autoloadable-macro-to-expand ...)

I suspect this will often fail to work because autoloads are often
generated by a fresh new session where `my-autoloadable-macro-to-expand`
will not yet be defined.

So at the very least, your patch should make sure to signal an error
when the cookie is of the form `;;;autoload-expand` by the head is not
currently defined as a macro.

I've been wanting to add the feature you propose, but this "macro is not
defined" has gotten in the way until now.  I think we need to add
something like a file-local `autoload-requires-for-macros`.

        Stefan