]> git.eshelyaron.com Git - emacs.git/commitdiff
cus-start.el: Reliably distinguish preload from nonpreload
authorStefan Monnier <monnier@iro.umontreal.ca>
Sat, 28 Jun 2025 02:55:04 +0000 (22:55 -0400)
committerEshel Yaron <me@eshelyaron.com>
Wed, 23 Jul 2025 20:06:35 +0000 (22:06 +0200)
`dump-mode` can be nil even if we're about to dump (this is
done in the Android build), so don't rely on it to distinguish
if `cus-start` is loaded from `loadup.el` vs loaded during
a "normal run".

* lisp/loadup.el (cus-start): Bind `cus-start--preload`.
* lisp/cus-start.el: <top-level>: Test it rather than `dump-mode`.

(cherry picked from commit cb484ead91cb20f1cad31ac878a65ea1e9354871)

lisp/cus-start.el
lisp/loadup.el

index a092f1334e087058061ce2a2b1bbd293fb982817..b89d4331f9b08b7814cd01cc566d9f526cd837d5 100644 (file)
@@ -939,11 +939,10 @@ since it could result in memory overflow and make Emacs crash."
          (put symbol 'custom-set (cadr prop)))
       ;; This is used by describe-variable.
       (if version (put symbol 'custom-version version))
-      ;; If this is NOT while dumping Emacs, set up the rest of the
-      ;; customization info.  This is the stuff that is not needed
-      ;; until someone does M-x customize etc.
-      (if (or dump-mode (and (featurep 'android) (not after-init-time)))
-         ;; Don't re-add to custom-delayed-init-variables post-startup.
+      ;; `cus-start' can be loaded twice: it's preloaded by `loadup.el'
+      ;; (at which point we don't set up all the info) but can be *re*loaded
+      ;; later on demand by `custom' (and `info-xref') to get the full info.
+      (if (bound-and-true-p cus-start--preload)
          ;; Note this is the _only_ initialize property we handle.
          (if (eq (cadr (memq :initialize rest)) #'custom-initialize-delay)
              ;; These vars are defined early and should hence be initialized
@@ -951,6 +950,8 @@ since it could result in memory overflow and make Emacs crash."
               ;; them to the end of custom-delayed-init-variables.  Otherwise,
              ;; auto-save-file-name-transforms will appear in customize-rogue.
              (add-to-list 'custom-delayed-init-variables symbol 'append))
+       ;; We're not preloading, so set up the rest of the customization info.
+        ;; This is the stuff that is not needed until M-x customize etc.
        ;; Add it to the right group(s).
        (if (listp group)
            (dolist (g group)
index a347c48a95e59ca7cb4b76f78f48d00a06a0441e..1510c6ef4367568ce23d89bd0b6ada013da13704 100644 (file)
            (compiled-function-p (symbol-function 'macroexpand-all)))
   (setq internal-make-interpreted-closure-function
         #'cconv-make-interpreted-closure))
-(load "cus-start") ;Late to reduce customize-rogue (needs loaddefs.el anyway)
+(dlet ((cus-start--preload t)) ;; Tell `cus-start' we're preloading.
+  (load "cus-start")) ;Late to reduce customize-rogue (needs loaddefs.el anyway)
 (load "tooltip")
 (load "international/iso-transl") ; Binds Alt-[ and friends.