From: Stefan Monnier Date: Fri, 11 Sep 2009 21:25:44 +0000 (+0000) Subject: * custom.el (custom-delayed-init-variables): New var. X-Git-Tag: emacs-pretest-23.1.90~1373 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=790d02708fd44b5a4953a6f155a1e2f07658d7f7;p=emacs.git * 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). --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 64b3612c7f4..f2792ed6f16 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,6 +1,14 @@ 2009-09-11 Stefan Monnier - * 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 diff --git a/lisp/abbrev.el b/lisp/abbrev.el index 6441381d171..f45f4c1860c 100644 --- a/lisp/abbrev.el +++ b/lisp/abbrev.el @@ -40,7 +40,8 @@ (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 diff --git a/lisp/custom.el b/lisp/custom.el index 07533253d76..c6b8f2950e4 100644 --- a/lisp/custom.el +++ b/lisp/custom.el @@ -130,6 +130,17 @@ For the standard setting, use `set-default'." (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, diff --git a/lisp/startup.el b/lisp/startup.el index 5802b33b643..fcb35b95f02 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -703,7 +703,6 @@ opening the first frame (e.g. open a connection to an X server).") (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) @@ -909,6 +908,14 @@ opening the first frame (e.g. open a connection to an X server).") ;; 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)