aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2001-12-31 20:13:54 +0000
committerRichard M. Stallman2001-12-31 20:13:54 +0000
commitd75fa08f60c8334d9b7c4f0e29cb6f9473f355a0 (patch)
treedfcea494527e7bd6d39c8058b4bd2c3d9884e481
parent8df9cd9edc9003cb2672250a2f39697719987981 (diff)
downloademacs-d75fa08f60c8334d9b7c4f0e29cb6f9473f355a0.tar.gz
emacs-d75fa08f60c8334d9b7c4f0e29cb6f9473f355a0.zip
(custom-face-edit-fix-value): New function.
(custom-face-edit): Use it, to convert :italic and :bold to new forms.
-rw-r--r--lisp/cus-edit.el24
1 files changed, 24 insertions, 0 deletions
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 2f037bfe45e..c78bce11aad 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -2459,6 +2459,10 @@ restoring it to the state of a variable that has never been customized."
2459 :tag "Attributes" 2459 :tag "Attributes"
2460 :extra-offset 12 2460 :extra-offset 12
2461 :button-args '(:help-echo "Control whether this attribute has any effect.") 2461 :button-args '(:help-echo "Control whether this attribute has any effect.")
2462 :value-to-internal 'custom-face-edit-fix-value
2463 :match (lambda (widget value)
2464 (widget-checklist-match widget
2465 (custom-face-edit-fix-value widget value)))
2462 :convert-widget 'custom-face-edit-convert-widget 2466 :convert-widget 'custom-face-edit-convert-widget
2463 :args (mapcar (lambda (att) 2467 :args (mapcar (lambda (att)
2464 (list 'group 2468 (list 'group
@@ -2468,6 +2472,26 @@ restoring it to the state of a variable that has never been customized."
2468 (nth 1 att))) 2472 (nth 1 att)))
2469 custom-face-attributes)) 2473 custom-face-attributes))
2470 2474
2475(defun custom-face-edit-fix-value (widget value)
2476 "Ignoring WIDGET, convert :bold and :italic in VALUE to new form."
2477 (let (result)
2478 (while value
2479 (assert (cdr value))
2480 (let ((key (car value))
2481 (val (car (cdr value))))
2482 (cond ((eq key :italic)
2483 (push :slant result)
2484 (push (if val 'italic 'normal) result))
2485 ((eq key :bold)
2486 (push :weight result)
2487 (push (if val 'bold 'normal) result))
2488 (t
2489 (push key result)
2490 (push val result))))
2491 (setq value (cdr (cdr value))))
2492 (setq result (nreverse result))
2493 result))
2494
2471(defun custom-face-edit-convert-widget (widget) 2495(defun custom-face-edit-convert-widget (widget)
2472 "Convert :args as widget types in WIDGET." 2496 "Convert :args as widget types in WIDGET."
2473 (widget-put 2497 (widget-put