From 91fc9992460861aa28295018b088fdd3b4b175c4 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Tue, 28 Nov 2000 07:48:39 +0000 Subject: [PATCH] (custom-face-attributes): Handle mapping `nil' and `unspecified' to `off' and `nil' in the :box pre-/post-filters. --- lisp/cus-face.el | 57 ++++++++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/lisp/cus-face.el b/lisp/cus-face.el index 90997096291..dc2461c0e1e 100644 --- a/lisp/cus-face.el +++ b/lisp/cus-face.el @@ -173,34 +173,39 @@ (const :tag "None" nil)))) ;; filter to make value suitable for customize (lambda (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 :style)))) - (list :line-width lwidth :color color :style style))) + (if (null real-value) + 'off + (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 :style)))) + (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))) + (cond ((null cus-value) + 'unspecified) + ((eq cus-value 'off) + nil) + (t + (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)))))))))) (:inverse-video (choice :tag "Inverse-video" -- 2.39.2