(custom-initialize-delay): New function.
* startup.el (command-line): "Re"evaluate all vars in
custom-delayed-init-variables. Don't reevaluate abbrev-file-name
explicitly any more.
* abbrev.el (abbrev-file-name): Use custom-initialize-delay
to avoid creating a ~/.emacs.d at build-time (bug#4347).
2009-09-11 Stefan Monnier <monnier@iro.umontreal.ca>
- * proced.el (proced-mode-map): Prefer "m" for proced-mark.
+ * custom.el (custom-delayed-init-variables): New var.
+ (custom-initialize-delay): New function.
+ * startup.el (command-line): "Re"evaluate all vars in
+ custom-delayed-init-variables. Don't reevaluate abbrev-file-name
+ explicitly any more.
+ * abbrev.el (abbrev-file-name): Use custom-initialize-delay
+ to avoid creating a ~/.emacs.d at build-time (bug#4347).
+
+ * proced.el (proced-mode-map): Prefer "m" for proced-mark (bug#4362).
2009-09-11 Nick Roberts <nickrob@snap.net.nz>
(defcustom abbrev-file-name
(locate-user-emacs-file "abbrev_defs" ".abbrev_defs")
- "Default name of file to read abbrevs from."
+ "Default name of file from which to read abbrevs."
+ :initialize 'custom-initialize-delay
:type 'file)
(defcustom only-global-abbrevs nil
(t
(set-default symbol (eval value)))))
+(defvar custom-delayed-init-variables nil
+ "List of variables whose initialization is pending.")
+
+(defun custom-initialize-delay (symbol value)
+ "Delay initialization of SYMBOL to the next Emacs start.
+This is used in files that are preloaded, so that the initialization is
+done in the run-time context rather than the build-time context.
+This also has the side-effect that the (delayed) initialization is performed
+with the :setter."
+ (push symbol custom-delayed-init-variables))
+
(defun custom-declare-variable (symbol default doc &rest args)
"Like `defcustom', but SYMBOL and DEFAULT are evaluated as normal arguments.
DEFAULT should be an expression to evaluate to compute the default value,
(custom-reevaluate-setting 'temporary-file-directory)
(custom-reevaluate-setting 'small-temporary-file-directory)
(custom-reevaluate-setting 'auto-save-file-name-transforms)
- (custom-reevaluate-setting 'abbrev-file-name)
;; Force recomputation, in case it was computed during the dump.
(setq abbreviated-home-dir nil)
;; Otherwise, enable tool-bar-mode.
(tool-bar-mode 1)))
+ ;; Re-evaluate predefined variables whose initial value depends on
+ ;; the runtime context.
+ (mapc 'custom-reevaluate-setting
+ ;; Initialize them in the same order they were loaded, in case there
+ ;; are dependencies between them.
+ (prog1 (nreverse custom-delayed-init-variables)
+ (setq custom-delayed-init-variables nil)))
+
;; Can't do this init in defcustom because the relevant variables
;; are not set.
(custom-reevaluate-setting 'blink-cursor-mode)