aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2021-04-22 09:32:04 -0400
committerStefan Monnier2021-04-22 09:32:04 -0400
commit2fb271ca35ff96540c0940b0ea5281bdaac953ec (patch)
tree9e37b020834a551892b3f8e398e1fd4f6138381f
parent846989498b66f94739e78ca274c8d1176c137591 (diff)
downloademacs-2fb271ca35ff96540c0940b0ea5281bdaac953ec.tar.gz
emacs-2fb271ca35ff96540c0940b0ea5281bdaac953ec.zip
Fix unload+reload of files using `custom-initialize-delay` (bug#47072)
* lisp/custom.el (custom-initialize-delay): Don't delay if `custom-delayed-init-variables` has already been processed. * lisp/startup.el (command-line): Mark `custom-delayed-init-variables` as processed.
-rw-r--r--lisp/custom.el11
-rw-r--r--lisp/startup.el2
2 files changed, 9 insertions, 4 deletions
diff --git a/lisp/custom.el b/lisp/custom.el
index 2c9eadbd479..614f8cf822d 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -117,9 +117,10 @@ For the standard setting, use `set-default'."
117 (set-default symbol (eval exp))))))) 117 (set-default symbol (eval exp)))))))
118 118
119(defvar custom-delayed-init-variables nil 119(defvar custom-delayed-init-variables nil
120 "List of variables whose initialization is pending.") 120 "List of variables whose initialization is pending until startup.
121Once this list has been processed, this var is set to a non-list value.")
121 122
122(defun custom-initialize-delay (symbol _value) 123(defun custom-initialize-delay (symbol value)
123 "Delay initialization of SYMBOL to the next Emacs start. 124 "Delay initialization of SYMBOL to the next Emacs start.
124This is used in files that are preloaded (or for autoloaded 125This is used in files that are preloaded (or for autoloaded
125variables), so that the initialization is done in the run-time 126variables), so that the initialization is done in the run-time
@@ -133,7 +134,11 @@ the :set function."
133 ;; This seemed to be at least as good as setting it to an arbitrary 134 ;; This seemed to be at least as good as setting it to an arbitrary
134 ;; value like nil (evaluating `value' is not an option because it 135 ;; value like nil (evaluating `value' is not an option because it
135 ;; may have undesirable side-effects). 136 ;; may have undesirable side-effects).
136 (push symbol custom-delayed-init-variables)) 137 (if (listp custom-delayed-init-variables)
138 (push symbol custom-delayed-init-variables)
139 ;; In case this is called after startup, there is no "later" to which to
140 ;; delay it, so initialize it "normally" (bug#47072).
141 (custom-initialize-reset symbol value)))
137 142
138(defun custom-declare-variable (symbol default doc &rest args) 143(defun custom-declare-variable (symbol default doc &rest args)
139 "Like `defcustom', but SYMBOL and DEFAULT are evaluated as normal arguments. 144 "Like `defcustom', but SYMBOL and DEFAULT are evaluated as normal arguments.
diff --git a/lisp/startup.el b/lisp/startup.el
index 4d4c65e6c41..c1267274d92 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1175,7 +1175,7 @@ please check its value")
1175 ;; are dependencies between them. 1175 ;; are dependencies between them.
1176 (nreverse custom-delayed-init-variables)) 1176 (nreverse custom-delayed-init-variables))
1177 (mapc #'custom-reevaluate-setting custom-delayed-init-variables) 1177 (mapc #'custom-reevaluate-setting custom-delayed-init-variables)
1178 (setq custom-delayed-init-variables nil) 1178 (setq custom-delayed-init-variables t)
1179 1179
1180 ;; Warn for invalid user name. 1180 ;; Warn for invalid user name.
1181 (when init-file-user 1181 (when init-file-user