]> code.delx.au - gnu-emacs/blobdiff - lisp/custom.el
(eshell-windows-shell-file): Look for command.com, not command.exe.
[gnu-emacs] / lisp / custom.el
index be65c865f0693560d6d000cd899eb729c2ad2e83..0831535f181f56206931674a21d849fee89a5514 100644 (file)
@@ -1,7 +1,7 @@
 ;;; custom.el --- tools for declaring and initializing options
 ;;
 ;;; custom.el --- tools for declaring and initializing options
 ;;
-;; Copyright (C) 1996, 1997, 1999, 2001, 2002, 2004, 2005
-;;  Free Software Foundation, Inc.
+;; Copyright (C) 1996, 1997, 1999, 2001, 2002, 2003, 2004,
+;;   2005 Free Software Foundation, Inc.
 ;;
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Maintainer: FSF
 ;;
 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
 ;; Maintainer: FSF
@@ -80,9 +80,9 @@ if any, or 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
   "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 used to compute VALUE are not yet defined.
-You can then re-evaluate VALUE in startup.el, for instance using
-`custom-reevaluate-setting'."
+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))))
   (condition-case nil
       (custom-initialize-set symbol value)
     (error (set-default symbol nil))))
@@ -91,9 +91,9 @@ You can then re-evaluate VALUE in startup.el, for instance using
   "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
   "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 used to compute VALUE are not yet defined.
-You can then re-evaluate VALUE in startup.el, for instance using
-`custom-reevaluate-setting'."
+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))))
   (condition-case nil
       (custom-initialize-default symbol value)
     (error (set-default symbol nil))))
@@ -137,14 +137,9 @@ For the standard setting, use `set-default'."
 DEFAULT should be an expression to evaluate to compute the default value,
 not the default value itself.
 
 DEFAULT should be an expression to evaluate to compute the default value,
 not the default value itself.
 
-DEFAULT is stored as SYMBOL's value in the standard theme.  See
-`custom-known-themes' for a list of known themes.  For backwards
-compatibility, DEFAULT is also stored in SYMBOL's property
+DEFAULT is stored as SYMBOL's standard value, in SYMBOL's property
 `standard-value'.  At the same time, SYMBOL's property `force-value' is
 set to nil, as the value is no longer rogue."
 `standard-value'.  At the same time, SYMBOL's property `force-value' is
 set to nil, as the value is no longer rogue."
-  ;; Remember the standard setting.  The value should be in the standard
-  ;; theme, not in this property.  However, this would require changing
-  ;; the C source of defvar and others as well...
   (put symbol 'standard-value (list default))
   ;; Maybe this option was rogue in an earlier version.  It no longer is.
   (when (get symbol 'force-value)
   (put symbol 'standard-value (list default))
   ;; Maybe this option was rogue in an earlier version.  It no longer is.
   (when (get symbol 'force-value)
@@ -589,7 +584,7 @@ This recursively follows aliases."
    "Themes that have been defined with `deftheme'.
 The default value is the list (user standard).  The theme `standard'
 contains the Emacs standard settings from the original Lisp files.  The
    "Themes that have been defined with `deftheme'.
 The default value is the list (user standard).  The theme `standard'
 contains the Emacs standard settings from the original Lisp files.  The
-theme `user' contains all the the settings the user customized and saved.
+theme `user' contains all the settings the user customized and saved.
 Additional themes declared with the `deftheme' macro will be added to
 the front of this list.")
 
 Additional themes declared with the `deftheme' macro will be added to
 the front of this list.")
 
@@ -685,10 +680,10 @@ COMMENT is a comment string about SYMBOL."
   (apply 'custom-theme-set-variables 'user args))
 
 (defun custom-reevaluate-setting (symbol)
   (apply 'custom-theme-set-variables 'user args))
 
 (defun custom-reevaluate-setting (symbol)
-  "Reset the value of SYMBOL by re-evaluating its saved or default value.
-This is useful for variables that are defined before their default value
-can really be computed.  E.g. dumped variables whose default depends on
-run-time information."
+  "Reset the value of SYMBOL by re-evaluating its saved or standard value.
+Use the :set function to do so.  This is useful for customizable options
+that are defined before their standard value can really be computed.
+E.g. dumped variables whose default depends on run-time information."
   (funcall (or (get symbol 'custom-set) 'set-default)
           symbol
           (eval (car (or (get symbol 'saved-value) (get symbol 'standard-value))))))
   (funcall (or (get symbol 'custom-set) 'set-default)
           symbol
           (eval (car (or (get symbol 'saved-value) (get symbol 'standard-value))))))
@@ -731,15 +726,13 @@ in SYMBOL's list property `theme-value' \(using `custom-push-theme')."
                         (error "Circular custom dependency between `%s' and `%s'"
                                sym1 sym2))
                        (2-then-1 nil)
                         (error "Circular custom dependency between `%s' and `%s'"
                                sym1 sym2))
                        (2-then-1 nil)
-                       ;; Put symbols with :require last.  The macro
-                       ;; define-minor-mode generates a defcustom
-                       ;; with a :require and a :set, where the
-                       ;; setter function calls the mode function.
-                       ;; Putting symbols with :require last ensures
-                       ;; that the mode function will see other
-                       ;; customized values rather than default
-                       ;; values.
-                       (t (nth 3 a2)))))))
+                       ;; Put minor modes and symbols with :require last.
+                       ;; Putting minor modes last ensures that the mode
+                       ;; function will see other customized values rather
+                       ;; than default values.
+                       (t (or (nth 3 a2)
+                               (eq (get sym2 'custom-set)
+                                   'custom-set-minor-mode))))))))
   (while args
     (let ((entry (car args)))
       (if (listp entry)
   (while args
     (let ((entry (car args)))
       (if (listp entry)
@@ -983,10 +976,16 @@ Every theme X has a property `provide-theme' whose value is \"X-theme\".
 ;; settings of enabled themes that apply to it.
 ;; The property value is a list of settings, each with the form
 ;; (THEME MODE VALUE).  THEME, MODE and VALUE are as above.
 ;; settings of enabled themes that apply to it.
 ;; The property value is a list of settings, each with the form
 ;; (THEME MODE VALUE).  THEME, MODE and VALUE are as above.
+;; Each of these lists is ordered by decreasing theme precedence.
+;; Thus, the first element is always the one that is in effect.
 
 
-;; When a theme is disabled, its settings are removed from the
-;; `theme-value' and `theme-face' properties, but the
-;; theme's own `theme-settings' property remains unchanged.
+;; Disabling a theme removes its settings from the `theme-value' and
+;; `theme-face' properties, but the theme's own `theme-settings'
+;; property remains unchanged.
+
+;; Loading a theme implicitly enables it.  Enabling a theme adds its
+;; settings to the symbols' `theme-value' and `theme-face' properties,
+;; or moves them to the front of those lists if they're already present.
 
 (defvar custom-loaded-themes nil
   "Custom themes that have been loaded.")
 
 (defvar custom-loaded-themes nil
   "Custom themes that have been loaded.")
@@ -1101,7 +1100,8 @@ If it is already enabled, just give it highest precedence (after `user')."
        (if (eq prop 'theme-value)
            (custom-theme-recalc-variable symbol)
          (custom-theme-recalc-face symbol)))))
        (if (eq prop 'theme-value)
            (custom-theme-recalc-variable symbol)
          (custom-theme-recalc-face symbol)))))
-  (push theme custom-enabled-themes)
+  (setq custom-enabled-themes
+        (cons theme (delq theme custom-enabled-themes)))
   ;; `user' must always be the highest-precedence enabled theme.
   (unless (eq theme 'user)
     (custom-enable-theme 'user)))
   ;; `user' must always be the highest-precedence enabled theme.
   (unless (eq theme 'user)
     (custom-enable-theme 'user)))