]> code.delx.au - gnu-emacs/commitdiff
(custom-face-edit-fix-value): New function.
authorRichard M. Stallman <rms@gnu.org>
Mon, 31 Dec 2001 20:13:54 +0000 (20:13 +0000)
committerRichard M. Stallman <rms@gnu.org>
Mon, 31 Dec 2001 20:13:54 +0000 (20:13 +0000)
(custom-face-edit): Use it, to convert :italic and :bold to new forms.

lisp/cus-edit.el

index 2f037bfe45e621f6065757749b1126ef821ea356..c78bce11aadbe4fbbe025240cff53d6cbbf7d602 100644 (file)
@@ -2459,6 +2459,10 @@ restoring it to the state of a variable that has never been customized."
   :tag "Attributes"
   :extra-offset 12
   :button-args '(:help-echo "Control whether this attribute has any effect.")
+  :value-to-internal 'custom-face-edit-fix-value
+  :match (lambda (widget value)
+          (widget-checklist-match widget 
+                                  (custom-face-edit-fix-value widget value)))
   :convert-widget 'custom-face-edit-convert-widget
   :args (mapcar (lambda (att)
                  (list 'group
@@ -2468,6 +2472,26 @@ restoring it to the state of a variable that has never been customized."
                        (nth 1 att)))
                custom-face-attributes))
 
+(defun custom-face-edit-fix-value (widget value)
+  "Ignoring WIDGET, convert :bold and :italic in VALUE to new form."
+  (let (result)
+    (while value
+      (assert (cdr value))
+      (let ((key (car value))
+           (val (car (cdr value))))
+       (cond ((eq key :italic)
+              (push :slant result)
+              (push (if val 'italic 'normal) result))
+             ((eq key :bold)
+              (push :weight result)
+              (push (if val 'bold 'normal) result))
+             (t 
+              (push key result)
+              (push val result))))
+      (setq value (cdr (cdr value))))
+    (setq result (nreverse result))
+    result))
+
 (defun custom-face-edit-convert-widget (widget)
   "Convert :args as widget types in WIDGET."
   (widget-put