summaryrefslogtreecommitdiff
path: root/lisp/cus-face.el
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2000-11-28 06:41:19 +0000
committerMiles Bader <miles@gnu.org>2000-11-28 06:41:19 +0000
commit36b80a0dd40879ab14221baeaec8100ffcbba59e (patch)
treeede71571b773679b980e82431a1c3847b51abef6 /lisp/cus-face.el
parentd970106bfbcee014036ba019a58a9ab8b7c3ddd7 (diff)
downloademacs-36b80a0dd40879ab14221baeaec8100ffcbba59e.tar.gz
(custom-face-attributes): Add post-filter function for :box.
Make pre-filter function for :box handle all cases.
Diffstat (limited to 'lisp/cus-face.el')
-rw-r--r--lisp/cus-face.el36
1 files changed, 29 insertions, 7 deletions
diff --git a/lisp/cus-face.el b/lisp/cus-face.el
index 7c4930ff990..dd6692bc9e8 100644
--- a/lisp/cus-face.el
+++ b/lisp/cus-face.el
@@ -161,8 +161,7 @@
(const :tag "*" nil)
(const :tag "Off" off)
(list :tag "Box"
- :value (:line-width 2 :color "grey75"
- :style released-button)
+ :value (:line-width 2 :color "grey75" :style released-button)
(const :format "" :value :line-width)
(integer :tag "Width")
(const :format "" :value :color)
@@ -174,11 +173,34 @@
(const :tag "None" nil))))
;; filter to make value suitable for customize
(lambda (real-value)
- (if (consp real-value)
- (list :line-width (or (plist-get real-value :line-width) 1)
- :color (plist-get real-value :color)
- :style (plist-get real-value :style))
- real-value)))
+ (let ((lwidth
+ (or (and (consp real-value) (plist-get real-value :line-width))
+ (and (integerp real-value) real-value)
+ 1))
+ (color
+ (or (and (consp real-value) (plist-get real-value :color))
+ (and (stringp real-value) real-value)
+ nil))
+ (style
+ (and (consp real-value) (plist-get real-value :line-width))))
+ (list :line-width lwidth :color color :style style)))
+ ;; filter to make customized-value suitable for storing
+ (lambda (cus-value)
+ (if (consp cus-value)
+ (let ((lwidth (plist-get cus-value :line-width))
+ (color (plist-get cus-value :color))
+ (style (plist-get cus-value :style)))
+ (cond ((and (null color) (null style))
+ lwidth)
+ ((and (null lwidth) (null style))
+ ;; actually can't happen, because LWIDTH is always an int
+ color)
+ (t
+ ;; Keep as a plist, but remove null entries
+ (nconc (and lwidth `(:line-width ,lwidth))
+ (and color `(:color ,color))
+ (and style `(:style ,style))))))
+ cus-value)))
(:inverse-video
(choice :tag "Inverse-video"