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

From: JD Smith <[email-masked]>
Date: Fri, 11 Jul 2025 15:28:03 -0400

As mentioned over on emacs-devel, it's sometimes a problem that `loaddefs-gen' hard-codes the list of special macros it is willing to expand:

(memq car '(easy-mmode-define-global-mode define-global-minor-mode
			    define-globalized-minor-mode defun defmacro
			    easy-mmode-define-minor-mode define-minor-mode
			    define-inline cl-defun cl-defmacro cl-defgeneric
			    cl-defstruct pcase-defmacro iter-defun cl-iter-defun))

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 ...)

which allows package authors to "opt-in" to macro expansion of the following form during autoload generation.  It would be useful primarily for special macros that are not in the hard-coded list above, but which expand to other special macros that are.

Docs can be added if this looks good.