aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2007-09-17 02:13:51 +0000
committerRichard M. Stallman2007-09-17 02:13:51 +0000
commit01d2eac830341410dbe8b1ddfe340e80562bd04f (patch)
tree055e618b0476ce68511919c65902a7bcde79b6f4
parent595a68b4737ccade0463d6254fd38ec0dfde0759 (diff)
downloademacs-01d2eac830341410dbe8b1ddfe340e80562bd04f.tar.gz
emacs-01d2eac830341410dbe8b1ddfe340e80562bd04f.zip
(face-spec-set): When FRAME nil, look up each frame in SPEC.
-rw-r--r--lisp/faces.el49
1 files changed, 26 insertions, 23 deletions
diff --git a/lisp/faces.el b/lisp/faces.el
index 95c57d90cc0..f9dae8e399e 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1446,29 +1446,32 @@ If SPEC is nil, return nil."
1446FRAME is the frame whose frame-local face is set. FRAME nil means 1446FRAME is the frame whose frame-local face is set. FRAME nil means
1447do it on all frames. See `defface' for information about SPEC. 1447do it on all frames. See `defface' for information about SPEC.
1448If SPEC is nil, do nothing." 1448If SPEC is nil, do nothing."
1449 (let ((attrs (face-spec-choose spec frame))) 1449 (if frame
1450 (when spec 1450 (let ((attrs (face-spec-choose spec frame)))
1451 (face-spec-reset-face face frame)) 1451 (when spec
1452 (while attrs 1452 (face-spec-reset-face face frame))
1453 (let ((attribute (car attrs)) 1453 (while attrs
1454 (value (car (cdr attrs)))) 1454 (let ((attribute (car attrs))
1455 ;; Support some old-style attribute names and values. 1455 (value (car (cdr attrs))))
1456 (case attribute 1456 ;; Support some old-style attribute names and values.
1457 (:bold (setq attribute :weight value (if value 'bold 'normal))) 1457 (case attribute
1458 (:italic (setq attribute :slant value (if value 'italic 'normal))) 1458 (:bold (setq attribute :weight value (if value 'bold 'normal)))
1459 ((:foreground :background) 1459 (:italic (setq attribute :slant value (if value 'italic 'normal)))
1460 ;; Compatibility with 20.x. Some bogus face specs seem to 1460 ((:foreground :background)
1461 ;; exist containing things like `:foreground nil'. 1461 ;; Compatibility with 20.x. Some bogus face specs seem to
1462 (if (null value) (setq value 'unspecified))) 1462 ;; exist containing things like `:foreground nil'.
1463 (t (unless (assq attribute face-x-resources) 1463 (if (null value) (setq value 'unspecified)))
1464 (setq attribute nil)))) 1464 (t (unless (assq attribute face-x-resources)
1465 (when attribute 1465 (setq attribute nil))))
1466 (set-face-attribute face frame attribute value))) 1466 (when attribute
1467 (setq attrs (cdr (cdr attrs))))) 1467 (set-face-attribute face frame attribute value)))
1468 ;; When we reset the face based on its spec, then it is unmodified 1468 (setq attrs (cdr (cdr attrs)))))
1469 ;; as far as Custom is concerned. 1469 ;; When we reset the face based on its spec, then it is unmodified
1470 (if (null frame) 1470 ;; as far as Custom is concerned.
1471 (put (or (get face 'face-alias) face) 'face-modified nil))) 1471 (put (or (get face 'face-alias) face) 'face-modified nil)
1472 ;; Set each frame according to the rules implied by SPEC.
1473 (dolist (frame (frame-list))
1474 (face-spec-set face spec frame))))
1472 1475
1473 1476
1474(defun face-attr-match-p (face attrs &optional frame) 1477(defun face-attr-match-p (face attrs &optional frame)