# HG changeset patch # User Stefan Monnier # Date 1252803175 0 # Node ID f0794252d960131f688530a32d4e0d023b0fa528 # Parent bbe883d49650670973447d73518cb37d9faf08eb * mail/sendmail.el (send-mail-function): * tooltip.el (tooltip-mode): * simple.el (transient-mark-mode): * rfn-eshadow.el (file-name-shadow-mode): * frame.el (blink-cursor-mode): * font-core.el (global-font-lock-mode): * files.el (temporary-file-directory) (small-temporary-file-directory, auto-save-file-name-transforms): * epa-hook.el (auto-encryption-mode): * composite.el (global-auto-composition-mode): Use custom-initialize-delay. * startup.el (command-line): Don't explicitly call custom-reevaluate-setting for all the above vars. * custom.el (custom-initialize-safe-set) (custom-initialize-safe-default): Delete. diff -r bbe883d49650 -r f0794252d960 lisp/ChangeLog --- a/lisp/ChangeLog Sat Sep 12 22:32:52 2009 +0000 +++ b/lisp/ChangeLog Sun Sep 13 00:52:55 2009 +0000 @@ -1,3 +1,21 @@ +2009-09-13 Stefan Monnier + + * mail/sendmail.el (send-mail-function): + * tooltip.el (tooltip-mode): + * simple.el (transient-mark-mode): + * rfn-eshadow.el (file-name-shadow-mode): + * frame.el (blink-cursor-mode): + * font-core.el (global-font-lock-mode): + * files.el (temporary-file-directory) + (small-temporary-file-directory, auto-save-file-name-transforms): + * epa-hook.el (auto-encryption-mode): + * composite.el (global-auto-composition-mode): + Use custom-initialize-delay. + * startup.el (command-line): Don't explicitly call + custom-reevaluate-setting for all the above vars. + * custom.el (custom-initialize-safe-set) + (custom-initialize-safe-default): Delete. + 2009-09-12 Stefan Monnier * term/x-win.el (x-initialize-window-system): diff -r bbe883d49650 -r f0794252d960 lisp/composite.el --- a/lisp/composite.el Sat Sep 12 22:32:52 2009 +0000 +++ b/lisp/composite.el Sun Sep 13 00:52:55 2009 +0000 @@ -773,8 +773,10 @@ ;;;###autoload (define-global-minor-mode global-auto-composition-mode auto-composition-mode turn-on-auto-composition-if-enabled - :extra-args (dummy) - :initialize 'custom-initialize-safe-default + ;; This :extra-args' appears to be the result of a naive copy&paste + ;; from global-font-lock-mode. + ;; :extra-args (dummy) + :initialize 'custom-initialize-delay :init-value (not noninteractive) :group 'auto-composition :version "23.1") diff -r bbe883d49650 -r f0794252d960 lisp/custom.el --- a/lisp/custom.el Sat Sep 12 22:32:52 2009 +0000 +++ b/lisp/custom.el Sun Sep 13 00:52:55 2009 +0000 @@ -74,28 +74,6 @@ (eval (car (get symbol 'saved-value))) (eval value))))) -(defun custom-initialize-safe-set (symbol value) - "Like `custom-initialize-set', but catches errors. -If an error occurs during initialization, SYMBOL is set to nil -and no error is thrown. This is meant for use in pre-loaded files -where some variables or functions used to compute VALUE may not yet -be defined. You can then re-evaluate VALUE in startup.el, for instance -using `custom-reevaluate-setting'." - (condition-case nil - (custom-initialize-set symbol value) - (error (set-default symbol nil)))) - -(defun custom-initialize-safe-default (symbol value) - "Like `custom-initialize-default', but catches errors. -If an error occurs during initialization, SYMBOL is set to nil -and no error is thrown. This is meant for use in pre-loaded files -where some variables or functions used to compute VALUE may not yet -be defined. You can then re-evaluate VALUE in startup.el, for instance -using `custom-reevaluate-setting'." - (condition-case nil - (custom-initialize-default symbol value) - (error (set-default symbol nil)))) - (defun custom-initialize-reset (symbol value) "Initialize SYMBOL based on VALUE. Set the symbol, using its `:set' function (or `set-default' if it has none). @@ -139,6 +117,10 @@ 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." + ;; Until the var is actually initialized, it is kept unbound. + ;; This seemed to be at least as good as setting it to an arbitrary + ;; value like nil (evaluating `value' is not an option because it + ;; may have undesirable side-effects). (push symbol custom-delayed-init-variables)) (defun custom-declare-variable (symbol default doc &rest args) diff -r bbe883d49650 -r f0794252d960 lisp/epa-hook.el --- a/lisp/epa-hook.el Sat Sep 12 22:32:52 2009 +0000 +++ b/lisp/epa-hook.el Sun Sep 13 00:52:55 2009 +0000 @@ -86,6 +86,11 @@ With prefix argument ARG, turn auto encryption on if positive, else off. Return the new status of auto encryption (non-nil means on)." :global t :init-value t :group 'epa-file :version "23.1" + ;; We'd like to use custom-initialize-set here so the setup is done + ;; before dumping, but at the point where the defcustom is evaluated, + ;; the corresponding function isn't defined yet, so + ;; custom-initialize-set signals an error. + :initialize 'custom-initialize-delay (setq file-name-handler-alist (delq epa-file-handler file-name-handler-alist)) (remove-hook 'find-file-hooks 'epa-file-find-file-hook) diff -r bbe883d49650 -r f0794252d960 lisp/files.el --- a/lisp/files.el Sat Sep 12 22:32:52 2009 +0000 +++ b/lisp/files.el Sun Sep 13 00:52:55 2009 +0000 @@ -195,6 +195,7 @@ (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") "/tmp")))) "The directory for writing temporary files." :group 'files + :initialize 'custom-initialize-delay :type 'directory) (defcustom small-temporary-file-directory @@ -204,6 +205,7 @@ by programs that create small temporary files. This is for systems that have fast storage with limited space, such as a RAM disk." :group 'files + :initialize 'custom-initialize-delay :type '(choice (const nil) directory)) ;; The system null device. (Should reference NULL_DEVICE from C.) @@ -385,6 +387,7 @@ :group 'auto-save :type '(repeat (list (string :tag "Regexp") (string :tag "Replacement") (boolean :tag "Uniquify"))) + :initialize 'custom-initialize-delay :version "21.1") (defcustom save-abbrevs t diff -r bbe883d49650 -r f0794252d960 lisp/font-core.el --- a/lisp/font-core.el Sat Sep 12 22:32:52 2009 +0000 +++ b/lisp/font-core.el Sun Sep 13 00:52:55 2009 +0000 @@ -299,8 +299,9 @@ (define-globalized-minor-mode global-font-lock-mode font-lock-mode turn-on-font-lock-if-desired - :extra-args (dummy) - :initialize 'custom-initialize-safe-default + ;; What was this :extra-args thingy for? --Stef + ;; :extra-args (dummy) + :initialize 'custom-initialize-delay :init-value (not (or noninteractive emacs-basic-display)) :group 'font-lock :version "22.1") diff -r bbe883d49650 -r f0794252d960 lisp/frame.el --- a/lisp/frame.el Sat Sep 12 22:32:52 2009 +0000 +++ b/lisp/frame.el Sun Sep 13 00:52:55 2009 +0000 @@ -1605,7 +1605,7 @@ no-blinking-cursor (eq system-type 'ms-dos) (not (memq window-system '(x w32))))) - :initialize 'custom-initialize-safe-default + :initialize 'custom-initialize-delay :group 'cursor :global t (if blink-cursor-idle-timer (cancel-timer blink-cursor-idle-timer)) diff -r bbe883d49650 -r f0794252d960 lisp/mail/sendmail.el --- a/lisp/mail/sendmail.el Sat Sep 12 22:32:52 2009 +0000 +++ b/lisp/mail/sendmail.el Sun Sep 13 00:52:55 2009 +0000 @@ -168,6 +168,7 @@ (function-item feedmail-send-it :tag "Use Feedmail package") (function-item mailclient-send-it :tag "Use Mailclient package") function) + :initialize 'custom-initialize-delay :group 'sendmail) ;;;###autoload diff -r bbe883d49650 -r f0794252d960 lisp/rfn-eshadow.el --- a/lisp/rfn-eshadow.el Sat Sep 12 22:32:52 2009 +0000 +++ b/lisp/rfn-eshadow.el Sun Sep 13 00:52:55 2009 +0000 @@ -216,6 +216,11 @@ With prefix argument ARG, turn on if positive, otherwise off. Returns non-nil if the new state is enabled." :global t + ;; We'd like to use custom-initialize-set here so the setup is done + ;; before dumping, but at the point where the defcustom is evaluated, + ;; the corresponding function isn't defined yet, so + ;; custom-initialize-set signals an error. + :initialize 'custom-initialize-delay :init-value t :group 'minibuffer :version "22.1" diff -r bbe883d49650 -r f0794252d960 lisp/simple.el --- a/lisp/simple.el Sat Sep 12 22:32:52 2009 +0000 +++ b/lisp/simple.el Sun Sep 13 00:52:55 2009 +0000 @@ -3898,6 +3898,7 @@ commands which are sensitive to the Transient Mark mode." :global t :init-value (not noninteractive) + :initialize 'custom-initialize-delay :group 'editing-basics) ;; The variable transient-mark-mode is ugly: it can take on special diff -r bbe883d49650 -r f0794252d960 lisp/startup.el --- a/lisp/startup.el Sat Sep 12 22:32:52 2009 +0000 +++ b/lisp/startup.el Sun Sep 13 00:52:55 2009 +0000 @@ -698,10 +698,6 @@ after-init-time nil command-line-default-directory default-directory) - ;; Choose a reasonable location for temporary files. - (custom-reevaluate-setting 'temporary-file-directory) - (custom-reevaluate-setting 'small-temporary-file-directory) - (custom-reevaluate-setting 'auto-save-file-name-transforms) ;; Force recomputation, in case it was computed during the dump. (setq abbreviated-home-dir nil) @@ -914,18 +910,6 @@ ;; 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) - (custom-reevaluate-setting 'tooltip-mode) - (custom-reevaluate-setting 'global-font-lock-mode) - (custom-reevaluate-setting 'file-name-shadow-mode) - (custom-reevaluate-setting 'send-mail-function) - (custom-reevaluate-setting 'focus-follows-mouse) - (custom-reevaluate-setting 'global-auto-composition-mode) - (custom-reevaluate-setting 'transient-mark-mode) - (custom-reevaluate-setting 'auto-encryption-mode) (normal-erase-is-backspace-setup-frame) diff -r bbe883d49650 -r f0794252d960 lisp/tooltip.el --- a/lisp/tooltip.el Sat Sep 12 22:32:52 2009 +0000 +++ b/lisp/tooltip.el Sun Sep 13 00:52:55 2009 +0000 @@ -52,7 +52,7 @@ ;; Even if we start on a text-only terminal, make this non-nil by ;; default because we can open a graphical frame later (multi-tty). :init-value t - :initialize 'custom-initialize-safe-default + :initialize 'custom-initialize-delay :group 'tooltip (unless (or (null tooltip-mode) (fboundp 'x-show-tip)) (error "Sorry, tooltips are not yet available on this system"))