Subject: Changes to `loaddefs.el` for define-minor-mode

From: Stefan Monnier <[email-masked]>
Date: Wed, 20 Aug 2025 07:17:45 -0400

AFAICT, the new code seems to change the contents of `loaddefs.el` for
`define-minor-mode`, e.g.:

    % grep '(.*global-auto-revert-mode' **/*defs*.el
    lisp/ldefs-boot.el:(defvar global-auto-revert-mode nil "\
    lisp/ldefs-boot.el:(custom-autoload 'global-auto-revert-mode "autorevert" nil)
    lisp/ldefs-boot.el:(autoload 'global-auto-revert-mode "autorevert" "\
    lisp/ldefs-boot.el:evaluate `(default-value \\='global-auto-revert-mode)'.
    lisp/loaddefs.el:(autoload 'global-auto-revert-mode "autorevert" "\
    % 

As you can see the `global-auto-revert-mode` variable ends up
not preloaded.  I'm generally opposed to preloading variables, but the
change introduces a backward incompatibility with packages which presume
they can take the value of `global-auto-revert-mode` without resorting
to any `boundp` check, such as Magit.

So I suggest the patch below,

        Stefan

diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el
index 9e91a11204d..e0b3859136c 100644
--- a/lisp/emacs-lisp/loaddefs-gen.el
+++ b/lisp/emacs-lisp/loaddefs-gen.el
@@ -155,7 +155,7 @@ loaddefs-generate--shorten-autoload
 ;; employing :autoload-end to omit unneeded forms).
 (defconst loaddefs--defining-macros
   '( define-skeleton define-derived-mode define-compilation-mode
-     define-generic-mode define-globalized-minor-mode define-minor-mode
+     define-generic-mode define-globalized-minor-mode
      cl-defun defun* cl-defmacro defmacro* define-overloadable-function
      transient-define-prefix transient-define-suffix transient-define-infix
      transient-define-argument transient-define-group