aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorGlenn Morris2007-10-13 19:36:10 +0000
committerGlenn Morris2007-10-13 19:36:10 +0000
commit6b1e222c47d27d2c71a7e6578a799973237cb7db (patch)
tree9b02651694e4cec3113e85ee73e65a3408a77eb9 /lisp
parentfd9c6792e818750dc8e3fc0a0668b0588cf1a5a6 (diff)
downloademacs-6b1e222c47d27d2c71a7e6578a799973237cb7db.tar.gz
emacs-6b1e222c47d27d2c71a7e6578a799973237cb7db.zip
(face-spec-set): When FRAME is nil, set the default for
new frames (restores pre-2007-09-17 behavior). Doc fix.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/faces.el30
1 files changed, 16 insertions, 14 deletions
diff --git a/lisp/faces.el b/lisp/faces.el
index e1cfd8ac9aa..2e4791358dd 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1444,17 +1444,16 @@ If SPEC is nil, return nil."
1444(defun face-spec-set (face spec &optional frame) 1444(defun face-spec-set (face spec &optional frame)
1445 "Set FACE's attributes according to the first matching entry in SPEC. 1445 "Set FACE's attributes according to the first matching entry in SPEC.
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 (and change the default for new frames).
1448If SPEC is nil, do nothing." 1448See `defface' for information about SPEC. If SPEC is nil, do nothing."
1449 (if frame 1449 (let ((attrs (face-spec-choose spec frame)))
1450 (let ((attrs (face-spec-choose spec frame))) 1450 (when spec
1451 (when spec 1451 (face-spec-reset-face face (or frame t)))
1452 (face-spec-reset-face face frame)) 1452 (while attrs
1453 (while attrs 1453 (let ((attribute (car attrs))
1454 (let ((attribute (car attrs)) 1454 (value (car (cdr attrs))))
1455 (value (car (cdr attrs)))) 1455 ;; Support some old-style attribute names and values.
1456 ;; Support some old-style attribute names and values. 1456 (case attribute
1457 (case attribute
1458 (:bold (setq attribute :weight value (if value 'bold 'normal))) 1457 (:bold (setq attribute :weight value (if value 'bold 'normal)))
1459 (:italic (setq attribute :slant value (if value 'italic 'normal))) 1458 (:italic (setq attribute :slant value (if value 'italic 'normal)))
1460 ((:foreground :background) 1459 ((:foreground :background)
@@ -1463,9 +1462,12 @@ If SPEC is nil, do nothing."
1463 (if (null value) (setq value 'unspecified))) 1462 (if (null value) (setq value 'unspecified)))
1464 (t (unless (assq attribute face-x-resources) 1463 (t (unless (assq attribute face-x-resources)
1465 (setq attribute nil)))) 1464 (setq attribute nil))))
1466 (when attribute 1465 (when attribute
1467 (set-face-attribute face frame attribute value))) 1466 ;; If frame is nil, set the default for new frames.
1468 (setq attrs (cdr (cdr attrs))))) 1467 ;; Existing frames are handled below.
1468 (set-face-attribute face (or frame t) attribute value)))
1469 (setq attrs (cdr (cdr attrs)))))
1470 (unless frame
1469 ;; When we reset the face based on its spec, then it is unmodified 1471 ;; When we reset the face based on its spec, then it is unmodified
1470 ;; as far as Custom is concerned. 1472 ;; as far as Custom is concerned.
1471 (put (or (get face 'face-alias) face) 'face-modified nil) 1473 (put (or (get face 'face-alias) face) 'face-modified nil)