aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/cus-edit.el
diff options
context:
space:
mode:
authorChong Yidong <[email protected]>2010-10-15 20:16:34 -0400
committerChong Yidong <[email protected]>2010-10-15 20:16:34 -0400
commitda16abfc7e8b83dea385f717c50a58a3b458c35c (patch)
treea6cad5f89fc556b3248b36c195bc477a2c27f3a7 /lisp/cus-edit.el
parente3fc5b1907be5444ca6315c531ecff81e77c7bdb (diff)
Bugfixes for `customize-create-theme'.
* cus-theme.el (customize-create-theme): Delete overlays after erasing. If given a THEME arg, display only the faces of that arg instead of custom-theme--listed-faces. (custom-theme-variable-menu, custom-theme-variable-action) (custom-variable-reset-theme, custom-theme-delete-variable): Deleted. (custom-theme-add-variable, custom-theme-add-face): Apply value from the theme settings, instead of the current value. (custom-theme-add-var-1, custom-theme-add-face-1): New functions. (custom-theme-visit-theme): Allow calling outside theme buffers. (custom-theme-merge-theme): Don't enable the theme when merging. (custom-theme-write-variables, custom-theme-write-faces): Use the :shown-value properties to save buffer values, not global ones. (customize-themes): Display a warning about user customizations. * cus-edit.el (custom-variable-value-create) (custom-face-value-create): Obey new special properties :shown-value and :inhibit-magic.
Diffstat (limited to 'lisp/cus-edit.el')
-rw-r--r--lisp/cus-edit.el61
1 files changed, 41 insertions, 20 deletions
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index f7090bc322..793b5ccced 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -2460,7 +2460,13 @@ The following properties have special meanings for this widget:
:custom-form should be a symbol describing how to display and
edit the variable---either `edit' (using edit widgets),
`lisp' (as a Lisp sexp), or `mismatch' (should not happen);
- if nil, use the return value of `custom-variable-default-form'."
+ if nil, use the return value of `custom-variable-default-form'.
+
+:shown-value, if non-nil, should be a list whose `car' is the
+ variable value to display in place of the current value.
+
+:inhibit-magic, if non-nil, inhibits creating the magic
+ custom-state widget."
:format "%v"
:help-echo "Set or reset this variable."
:documentation-property #'custom-variable-documentation
@@ -2512,9 +2518,12 @@ try matching its doc string against `custom-guess-doc-alist'."
(get (or (get symbol 'custom-get) 'default-value))
(prefix (widget-get widget :custom-prefix))
(last (widget-get widget :custom-last))
- (value (if (default-boundp symbol)
- (funcall get symbol)
- (widget-get conv :value)))
+ (value (let ((shown-value (widget-get widget :shown-value)))
+ (cond (shown-value
+ (car shown-value))
+ ((default-boundp symbol)
+ (funcall get symbol))
+ (t (widget-get conv :value)))))
(state (or (widget-get widget :custom-state)
(if (memq (custom-variable-state symbol value)
(widget-get widget :hidden-states))
@@ -2622,10 +2631,11 @@ try matching its doc string against `custom-guess-doc-alist'."
(unless (eq (preceding-char) ?\n)
(widget-insert "\n"))
;; Create the magic button.
- (let ((magic (widget-create-child-and-convert
- widget 'custom-magic nil)))
- (widget-put widget :custom-magic magic)
- (push magic buttons))
+ (unless (widget-get widget :inhibit-magic)
+ (let ((magic (widget-create-child-and-convert
+ widget 'custom-magic nil)))
+ (widget-put widget :custom-magic magic)
+ (push magic buttons)))
(widget-put widget :buttons buttons)
;; Insert documentation.
(widget-put widget :documentation-indent 3)
@@ -3281,12 +3291,17 @@ The following properties have special meanings for this widget:
Lisp sexp), or `mismatch' (should not happen); if nil, use
the return value of `custom-face-default-form'.
-:display-style, if non-nil, should be a symbol describing the
- style of display to use. If the value is `concise', a more
- concise interface is shown.
+:display-style, if non-nil, describes the style of display to
+ use. If the value is `concise', a neater interface is shown.
+
+:sample-indent, if non-nil, is the number of columns to which to
+ indent the face sample (an integer).
-:sample-indent, if non-nil, should be an integer; this is the
-number of columns to which to indent the face sample."
+:shown-value, if non-nil, is the face spec to display as the value
+ of the widget, instead of the current face spec.
+
+:inhibit-magic, if non-nil, inhibits creating the magic
+ custom-state widget."
:sample-face 'custom-face-tag
:help-echo "Set or reset this face."
:documentation-property #'face-doc-string
@@ -3429,14 +3444,19 @@ WIDGET should be a `custom-face' widget."
(indent-to-column sample-indent)))
(push (widget-create-child-and-convert
widget 'item
- :format "[%{%t%}]" :sample-face symbol :tag "sample")
+ :format "[%{%t%}]"
+ :sample-face (let ((spec (widget-get widget :shown-value)))
+ (if spec (face-spec-choose spec) symbol))
+ :tag "sample")
buttons)
- ;; Magic.
(insert "\n")
- (let ((magic (widget-create-child-and-convert
- widget 'custom-magic nil)))
- (widget-put widget :custom-magic magic)
- (push magic buttons))
+
+ ;; Magic.
+ (unless (widget-get widget :inhibit-magic)
+ (let ((magic (widget-create-child-and-convert
+ widget 'custom-magic nil)))
+ (widget-put widget :custom-magic magic)
+ (push magic buttons)))
;; Update buttons.
(widget-put widget :buttons buttons)
@@ -3465,7 +3485,8 @@ WIDGET should be a `custom-face' widget."
(unless (widget-get widget :custom-form)
(widget-put widget :custom-form custom-face-default-form))
- (let* ((spec (custom-face-get-current-spec symbol))
+ (let* ((spec (or (widget-get widget :shown-value)
+ (custom-face-get-current-spec symbol)))
(form (widget-get widget :custom-form))
(indent (widget-get widget :indent))
face-alist face-entry spec-default spec-match editor)