changeset 42448:5269e6fd0fbc

(custom-face-edit-fix-value): New function. (custom-face-edit): Use it, to convert :italic and :bold to new forms.
author Richard M. Stallman <rms@gnu.org>
date Mon, 31 Dec 2001 20:13:54 +0000
parents 14a941a0ebdc
children b4510b1b83f3
files lisp/cus-edit.el
diffstat 1 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/cus-edit.el	Mon Dec 31 19:46:33 2001 +0000
+++ b/lisp/cus-edit.el	Mon Dec 31 20:13:54 2001 +0000
@@ -2459,6 +2459,10 @@
   :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 @@
 			(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