From e9800cabffa73018a83108de2bb4e1686f1e8385 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Thu, 14 Aug 2025 19:33:09 +0800 Subject: [PATCH] Fix generation of defvars defined by easy-mmode and company in loaddefs.el * lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--make-autoload): Restore previously existing conditions for recursing on macroexpansions when processing easy-mmode and related macros. --- lisp/emacs-lisp/loaddefs-gen.el | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el index c8e05921fc1..9e91a11204d 100644 --- a/lisp/emacs-lisp/loaddefs-gen.el +++ b/lisp/emacs-lisp/loaddefs-gen.el @@ -244,7 +244,25 @@ expand)' among their `declare' forms." (setq expand (let ((load-true-file-name file) (load-file-name file)) (macroexpand form))) - (not (eq car (car expand))))) + (or (and + ;; Previously, macros defined in this list would not + ;; see their expansions processed in place of + ;; themselves if such an expansion did not yield a + ;; `progn', `prog1' or `defalias' form. Not + ;; reproducing these conditions results in the + ;; omission of minor mode variables and suchlike in + ;; loaddefs.el when only the defuns in the + ;; macroexpansions are autoloaded. + (not (memq car '( define-globalized-minor-mode defun defmacro + define-minor-mode define-inline + cl-defun cl-defmacro cl-defgeneric + cl-defstruct pcase-defmacro iter-defun cl-iter-defun + ;; Obsolete; keep until the alias is removed. + easy-mmode-define-global-mode + easy-mmode-define-minor-mode + define-global-minor-mode))) + (not (eq car (car expand)))) + (memq (car expand) '(progn prog1 defalias))))) ;; Recurse on the expansion. (loaddefs-generate--make-autoload expand file 'expansion))