:mouse-down-action (lambda (&rest junk) t)
:action (lambda (widget &optional event)
(custom-reset event))))
+ (widget-insert " ")
+ (when (or custom-file user-init-file)
+ (widget-create 'push-button
+ :tag "Erase Customization"
+ :help-echo "\
+Un-customize all settings in this buffer--save them with standard values."
+ :action 'Custom-reset-standard)))
(widget-insert "\n ")
(widget-create 'push-button
:tag "Reset to Current"
:help-echo "\
Reset all settings in this buffer to their saved values."
:action 'Custom-reset-saved)
- (widget-insert " ")
- (when (or custom-file user-init-file)
- (widget-create 'push-button
- :tag "Erase Customization"
- :help-echo "\
-Un-customize all settings in this buffer--save them with standard values."
- :action 'Custom-reset-standard)))
(if (not custom-buffer-verbose-help)
(progn
(widget-insert " ")
;; backward-compatibility alias
(put 'custom-changed-face 'face-alias 'custom-changed)
+(defface custom-themed '((((min-colors 88) (class color))
+ (:foreground "white" :background "blue1"))
+ (((class color))
+ (:foreground "white" :background "blue"))
+ (t
+ (:slant italic)))
+ "Face used when the customize item has been set by a theme."
+ :group 'custom-magic-faces)
+
(defface custom-saved '((t (:underline t)))
"Face used when the customize item has been saved."
:group 'custom-magic-faces)
(saved "!" custom-saved "\
SAVED and set." "\
something in this group has been set and saved.")
+ (themed "o" custom-themed "\
+THEMED." "\
+visible group members are all at standard values.")
(rogue "@" custom-rogue "\
NO CUSTOMIZATION DATA; not intended to be customized." "\
something in this group is not prepared for customization.")
(and (equal value (eval (car tmp)))
(equal comment temp))
(error nil))
- 'saved
+ (cond
+ ((eq 'user (caar (get symbol 'theme-value)))
+ 'saved)
+ ((eq 'standard (caar (get symbol 'theme-value)))
+ 'changed)
+ (t 'themed))
'changed))
((setq tmp (get symbol 'standard-value))
(if (condition-case nil
(put symbol 'customized-variable-comment nil)
(when (or (get symbol 'saved-value) (get symbol 'saved-variable-comment))
(put symbol 'saved-value nil)
- (custom-push-theme 'theme-value symbol 'user 'reset 'standard)
- ;; As a special optimizations we do not (explictly)
- ;; save resets to standard when no theme set the value.
- (if (null (cdr (get symbol 'theme-value)))
- (put symbol 'theme-value nil))
+ (custom-push-theme 'theme-value symbol 'user 'reset nil)
(put symbol 'saved-variable-comment nil)
(custom-save-all))
(widget-put widget :custom-state 'unknown)
(put symbol 'customized-face-comment nil)
(when (or (get symbol 'saved-face) (get symbol 'saved-face-comment))
(put symbol 'saved-face nil)
- (custom-push-theme 'theme-face symbol 'user 'reset 'standard)
+ (custom-push-theme 'theme-face symbol 'user 'reset nil)
;; Do not explictly save resets to standards without themes.
(if (null (cdr (get symbol 'theme-face)))
(put symbol 'theme-face nil))
MODE can be either the symbol `set' or the symbol `reset'. If it is the
symbol `set', then VALUE is the value to use. If it is the symbol
-`reset', then VALUE is another theme, whose value for this face or
-variable should be used.
+`reset', then VALUE is either another theme, which means to use the
+value defined by that theme; or nil, which means to remove SYMBOL from
+THEME entirely.
-In the following example for the variable `goto-address-url-face', the
-theme `subtle-hacker' uses the same value for the variable as the theme
-`gnome2':
+In the following example, the variable `goto-address-url-face' has been
+set by three different themes. Its `theme-value' property is:
- \((standard set bold)
- \(gnome2 set info-xref)
+ \((subtle-hacker reset gnome2)
\(jonadab set underline)
- \(subtle-hacker reset gnome2))
-
-
-If a value has been stored for themes A B and C, and a new value
-is to be stored for theme C, then the old value of C is discarded.
-If a new value is to be stored for theme B, however, the old value
-of B is not discarded because B is not the car of the list.
-
-For variables, list property PROP is `theme-value'.
-For faces, list property PROP is `theme-face'.
-This is used in `custom-do-theme-reset', for example.
+ \(gnome2 set info-xref)
-The list looks the same in any case; the examples shows a possible
-value of the `theme-face' property for the face `region':
+The theme `subtle-hacker' says to use the same value for the variable as
+the theme `gnome2'. The theme values set by each of these themes can be
+changed, but only the one defined by `subtle-hacker' takes effect, because
+the theme currently has the highest precedence. To change the precedence
+of the themes, use `enable-theme'.
- \((gnome2 set ((t (:foreground \"cyan\" :background \"dark cyan\"))))
- \(standard set ((((class color) (background dark))
- \(:background \"blue\"))
- \(t (:background \"gray\")))))
+The user has not customized the face; had he done that, the list would
+contain an entry for the `user' theme, too.
-This records values for the `standard' and the `gnome2' themes.
-The user has not customized the face; had he done that,
-the list would contain an entry for the `user' theme, too.
See `custom-known-themes' for a list of known themes."
+ (unless (or (eq prop 'theme-value)
+ (eq prop 'theme-face))
+ (error "Unknown theme property"))
(let* ((old (get symbol prop))
- (setting (assq theme old)))
- ;; Alter an existing theme-setting for the symbol,
- ;; or add a new one.
- (if setting
- (progn
- (setcar (cdr setting) mode)
- (setcar (cddr setting) value))
- ;; If no custom theme has been applied yet, first save the
- ;; current values to the 'standard theme.
- (if (null old)
- (if (and (eq prop 'theme-value)
- (boundp symbol))
- (setq old
- (list (list 'standard 'set (symbol-value symbol))))
- (if (facep symbol)
- (setq old (list (list 'standard 'set (list
- (append '(t) (custom-face-attributes-get symbol nil)))))))))
- (put symbol prop (cons (list theme mode value) old)))
- ;; Record, for each theme, all its settings.
- (put theme 'theme-settings
- (cons (list prop symbol theme mode value)
- (get theme 'theme-settings)))))
+ (setting (assq theme old))
+ (theme-settings (get theme 'theme-settings)))
+ (if (and (eq mode 'reset) (null value))
+ ;; Remove a setting.
+ (when setting
+ (let (res)
+ (dolist (theme-setting theme-settings)
+ (if (and (eq (car theme-setting) prop)
+ (eq (cadr theme-setting) symbol))
+ (setq res theme-setting)))
+ (put theme 'theme-settings (delq res theme-settings)))
+ (put symbol prop (delq setting old)))
+ (if setting
+ ;; Alter an existing setting.
+ (let (res)
+ (dolist (theme-setting theme-settings)
+ (if (and (eq (car theme-setting) prop)
+ (eq (cadr theme-setting) symbol))
+ (setq res theme-setting)))
+ (put theme 'theme-settings
+ (cons (list prop symbol theme mode value)
+ (delq res theme-settings)))
+ (setcar (cdr setting) mode)
+ (setcar (cddr setting) value))
+ ;; Add a new setting.
+ ;; If the user changed the value outside of Customize, we
+ ;; first save the current value to a fake theme, `standard'.
+ ;; This ensures that the user-set value comes back if the
+ ;; theme is later disabled.
+ (if (null old)
+ (if (and (eq prop 'theme-value)
+ (boundp symbol)
+ (or (null (get symbol 'standard-value))
+ (not (equal (eval (car (get symbol 'standard-value)))
+ (symbol-value symbol)))))
+ (setq old (list (list 'standard 'set (symbol-value symbol))))
+ (if (facep symbol)
+ (setq old (list (list 'standard 'set (list
+ (append '(t) (custom-face-attributes-get symbol nil)))))))))
+ (put symbol prop (cons (list theme mode value) old))
+ (put theme 'theme-settings
+ (cons (list prop symbol theme mode value)
+ theme-settings))))))
\f
(defvar custom-local-buffer nil
"Non-nil, in a Customization buffer, means customize a specific buffer.