Mercurial > emacs
changeset 67783:118df638c3ff
2005-12-23 Chong Yidong <cyd@stupidchicken.com>
* custom.el (custom-push-theme): Clarify docstring. VALUE nil for
reset means to remove setting from theme entirely. Don't keep
expanding theme-settings list; delete old entries if necessary.
* cus-edit.el (custom-buffer-create-internal): Move "Erase
customization" button one line up.
(custom-themed): New face.
(custom-magic-alist): New value, THEMED, for theme settings.
(custom-variable-state-set): Check theme-value.
(custom-variable-reset-standard, custom-face-reset-standard):
Remove theme setting entirely.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sat, 24 Dec 2005 01:26:54 +0000 |
parents | f2d49739378c |
children | 7c9d6a4a35c7 |
files | lisp/ChangeLog lisp/cus-edit.el lisp/custom.el |
diffstat | 3 files changed, 102 insertions(+), 64 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Fri Dec 23 22:14:50 2005 +0000 +++ b/lisp/ChangeLog Sat Dec 24 01:26:54 2005 +0000 @@ -1,3 +1,17 @@ +2005-12-23 Chong Yidong <cyd@stupidchicken.com> + + * custom.el (custom-push-theme): Clarify docstring. VALUE nil for + reset means to remove setting from theme entirely. Don't keep + expanding theme-settings list; delete old entries if necessary. + + * cus-edit.el (custom-buffer-create-internal): Move "Erase + customization" button one line up. + (custom-themed): New face. + (custom-magic-alist): New value, THEMED, for theme settings. + (custom-variable-state-set): Check theme-value. + (custom-variable-reset-standard, custom-face-reset-standard): + Remove theme setting entirely. + 2005-12-23 Juri Linkov <juri@jurta.org> * emacs-lisp/edebug.el (edebug-all-defs, edebug-all-forms):
--- a/lisp/cus-edit.el Fri Dec 23 22:14:50 2005 +0000 +++ b/lisp/cus-edit.el Sat Dec 24 01:26:54 2005 +0000 @@ -1477,6 +1477,13 @@ :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" @@ -1489,13 +1496,6 @@ :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 " ") @@ -1747,6 +1747,15 @@ ;; 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) @@ -1775,6 +1784,9 @@ (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.") @@ -2540,7 +2552,12 @@ (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 @@ -2751,11 +2768,7 @@ (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) @@ -3415,7 +3428,7 @@ (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))
--- a/lisp/custom.el Fri Dec 23 22:14:50 2005 +0000 +++ b/lisp/custom.el Sat Dec 24 01:26:54 2005 +0000 @@ -626,63 +626,74 @@ 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': - - \((standard set bold) - \(gnome2 set info-xref) - \(jonadab set underline) - \(subtle-hacker reset gnome2)) +In the following example, the variable `goto-address-url-face' has been +set by three different themes. Its `theme-value' property is: - -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. + \((subtle-hacker reset gnome2) + \(jonadab set underline) + \(gnome2 set info-xref) -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. +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'. -The list looks the same in any case; the examples shows a possible -value of the `theme-face' property for the face `region': +The user has not customized the face; had he done that, the list would +contain an entry for the `user' theme, too. - \((gnome2 set ((t (:foreground \"cyan\" :background \"dark cyan\")))) - \(standard set ((((class color) (background dark)) - \(:background \"blue\")) - \(t (:background \"gray\"))))) - -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)))))) (defvar custom-local-buffer nil "Non-nil, in a Customization buffer, means customize a specific buffer.