aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiles Bader2000-10-23 05:32:59 +0000
committerMiles Bader2000-10-23 05:32:59 +0000
commit96c2938fc90e85ea62c6c4fd9e108e1449dff591 (patch)
tree228274aebfafaaf1063d51560c2a859970bca869
parent984905989e6b003a54655502cc85dde21f9e2fed (diff)
downloademacs-96c2938fc90e85ea62c6c4fd9e108e1449dff591.tar.gz
emacs-96c2938fc90e85ea62c6c4fd9e108e1449dff591.zip
(face-user-default-spec, face-default-spec): New functions.
(face-spec-choose, face-spec-set): Document nil-SPEC behavior. (frame-set-background-mode, face-set-after-frame-default): Use `face-user-default-spec'. Simplify code slightly.
-rw-r--r--lisp/faces.el33
1 files changed, 19 insertions, 14 deletions
diff --git a/lisp/faces.el b/lisp/faces.el
index 28ebba796c4..ba0bfc70321 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1151,7 +1151,8 @@ If FRAME is nil, the current FRAME is used."
1151 1151
1152 1152
1153(defun face-spec-choose (spec &optional frame) 1153(defun face-spec-choose (spec &optional frame)
1154 "Choose the proper attributes for FRAME, out of SPEC." 1154 "Choose the proper attributes for FRAME, out of SPEC.
1155If SPEC is nil, return nil."
1155 (unless frame 1156 (unless frame
1156 (setq frame (selected-frame))) 1157 (setq frame (selected-frame)))
1157 (let ((tail spec) 1158 (let ((tail spec)
@@ -1178,7 +1179,8 @@ If FRAME is nil, the current FRAME is used."
1178(defun face-spec-set (face spec &optional frame) 1179(defun face-spec-set (face spec &optional frame)
1179 "Set FACE's attributes according to the first matching entry in SPEC. 1180 "Set FACE's attributes according to the first matching entry in SPEC.
1180FRAME is the frame whose frame-local face is set. FRAME nil means 1181FRAME is the frame whose frame-local face is set. FRAME nil means
1181do it on all frames. See `defface' for information about SPEC." 1182do it on all frames. See `defface' for information about SPEC.
1183If SPEC is nil, do nothing."
1182 (let ((attrs (face-spec-choose spec frame))) 1184 (let ((attrs (face-spec-choose spec frame)))
1183 (when attrs 1185 (when attrs
1184 (face-spec-reset-face face frame)) 1186 (face-spec-reset-face face frame))
@@ -1219,6 +1221,16 @@ is used. If nil or omitted, use the selected frame."
1219 "Return t if FACE, on FRAME, matches what SPEC says it should look like." 1221 "Return t if FACE, on FRAME, matches what SPEC says it should look like."
1220 (face-attr-match-p face (face-spec-choose spec frame) frame)) 1222 (face-attr-match-p face (face-spec-choose spec frame) frame))
1221 1223
1224(defun face-user-default-spec (face)
1225 "Return the user's customized face-spec for FACE, or the default if none.
1226If there is neither a user setting or a default for FACE, return nil."
1227 (or (get face 'saved-face)
1228 (get face 'face-defface-spec)))
1229
1230(defun face-default-spec (face)
1231 "Return the default face-spec for FACE, ignoring any user customization.
1232If there is no default for FACE, return nil."
1233 (get face 'face-defface-spec))
1222 1234
1223 1235
1224;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1236;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1351,11 +1363,7 @@ according to the `background-mode' and `display-type' frame parameters."
1351 ;; For all named faces, choose face specs matching the new frame 1363 ;; For all named faces, choose face specs matching the new frame
1352 ;; parameters. 1364 ;; parameters.
1353 (dolist (face (face-list)) 1365 (dolist (face (face-list))
1354 (let ((spec (or (get face 'saved-face) 1366 (face-spec-set face (face-user-default-spec face) frame)))))
1355 (get face 'face-defface-spec))))
1356 (when spec
1357 (face-spec-set face spec frame)))))))
1358
1359 1367
1360 1368
1361;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1369;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1440,13 +1448,10 @@ Value is the new frame created."
1440 "Set frame-local faces of FRAME from face specs and resources. 1448 "Set frame-local faces of FRAME from face specs and resources.
1441Initialize colors of certain faces from frame parameters." 1449Initialize colors of certain faces from frame parameters."
1442 (dolist (face (face-list)) 1450 (dolist (face (face-list))
1443 (let ((spec (or (get face 'saved-face) 1451 (face-spec-set face (face-user-default-spec face) frame)
1444 (get face 'face-defface-spec)))) 1452 (internal-merge-in-global-face face frame)
1445 (when spec 1453 (when (memq window-system '(x w32 mac))
1446 (face-spec-set face spec frame)) 1454 (make-face-x-resource-internal face frame)))
1447 (internal-merge-in-global-face face frame)
1448 (when (memq window-system '(x w32 mac))
1449 (make-face-x-resource-internal face frame))))
1450 1455
1451 ;; Initialize attributes from frame parameters. 1456 ;; Initialize attributes from frame parameters.
1452 (let ((params '((foreground-color default :foreground) 1457 (let ((params '((foreground-color default :foreground)