From: Stefan Monnier Date: Sat, 28 Jun 2025 02:55:04 +0000 (-0400) Subject: cus-start.el: Reliably distinguish preload from nonpreload X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f6aa3089fe80ee289b16b66ce69e265cc74789fc;p=emacs.git cus-start.el: Reliably distinguish preload from nonpreload `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: : Test it rather than `dump-mode`. (cherry picked from commit cb484ead91cb20f1cad31ac878a65ea1e9354871) --- diff --git a/lisp/cus-start.el b/lisp/cus-start.el index a092f1334e0..b89d4331f9b 100644 --- a/lisp/cus-start.el +++ b/lisp/cus-start.el @@ -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) diff --git a/lisp/loadup.el b/lisp/loadup.el index a347c48a95e..1510c6ef436 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el @@ -392,7 +392,8 @@ (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.