comparison lisp/faces.el @ 17947:057ea7eaaff3

Unconditionally create the standard faces at load time. Move face setup here from cus-start.el, and add attribute info.
author Richard M. Stallman <rms@gnu.org>
date Sun, 25 May 1997 21:52:33 +0000
parents 874de6432f05
children 4ef122a60b5a
comparison
equal deleted inserted replaced
17946:2b225f00d308 17947:057ea7eaaff3
1108 (let ((doc (face-doc-string face))) 1108 (let ((doc (face-doc-string face)))
1109 (if doc 1109 (if doc
1110 (princ doc) 1110 (princ doc)
1111 (princ "not documented as a face."))))) 1111 (princ "not documented as a face.")))))
1112 1112
1113 ;;; Make the standard faces.
1114 ;;; The C code knows the default and modeline faces as faces 0 and 1,
1115 ;;; so they must be the first two faces made.
1116 (defun face-initialize ()
1117 (make-face 'default)
1118 (make-face 'modeline)
1119 (make-face 'highlight)
1120
1121 ;; These aren't really special in any way, but they're nice to have around.
1122
1123 (make-face 'bold)
1124 (make-face 'italic)
1125 (make-face 'bold-italic)
1126 (make-face 'region)
1127 (make-face 'secondary-selection)
1128 (make-face 'underline)
1129
1130 ;; We no longer set up any face attributes here.
1131 ;; They are specified in cus-start.el.
1132
1133 (setq region-face (face-id 'region)))
1134
1135 ;;; Setting a face based on a SPEC. 1113 ;;; Setting a face based on a SPEC.
1136 1114
1137 (defun face-spec-set (face spec &optional frame) 1115 (defun face-spec-set (face spec &optional frame)
1138 "Set FACE's face attributes according to the first matching entry in SPEC. 1116 "Set FACE's face attributes according to the first matching entry in SPEC.
1139 If optional FRAME is non-nil, set it for that frame only. 1117 If optional FRAME is non-nil, set it for that frame only.
1477 (set-face-underline-p face t frame)) 1455 (set-face-underline-p face t frame))
1478 (t 1456 (t
1479 (funcall function face (car colors) frame))))) 1457 (funcall function face (car colors) frame)))))
1480 (setq colors (cdr colors))))))) 1458 (setq colors (cdr colors)))))))
1481 1459
1482 ;; If we are already using x-window frames, initialize faces for them. 1460 ;;; Make the standard faces.
1483 (if (memq (framep (selected-frame)) '(x w32)) 1461 ;;; The C code knows the default and modeline faces as faces 0 and 1,
1484 (face-initialize)) 1462 ;;; so they must be the first two faces made.
1463 (make-face 'default)
1464 (make-face 'modeline)
1465 (make-face 'highlight)
1466
1467 ;; These aren't really special in any way, but they're nice to have around.
1468
1469 (make-face 'bold)
1470 (make-face 'italic)
1471 (make-face 'bold-italic)
1472 (make-face 'region)
1473 (make-face 'secondary-selection)
1474 (make-face 'underline)
1475
1476 (setq region-face (face-id 'region))
1477
1478 ;; Specify how these faces look, and their documentation.
1479 (let ((all '((bold "Use bold font." ((t (:bold t))))
1480 (bold-italic "Use bold italic font." ((t (:bold t :italic t))))
1481 (italic "Use italic font." ((t (:italic t))))
1482 (underline "Underline text." ((t (:underline t))))
1483 (default "Used for text not covered by other faces." ((t nil)))
1484 (highlight "Highlight text in some way."
1485 ((((class color)) (:background "darkseagreen2"))
1486 (t (:inverse-video t))))
1487 (modeline "Used for displaying the modeline."
1488 ((t (:inverse-video t))))
1489 (region "Used for displaying the region."
1490 ((t (:background "gray"))))
1491 (secondary-selection
1492 "Used for displaying the secondary selection."
1493 ((((class color)) (:background "paleturquoise"))
1494 (t (:inverse-video t))))))
1495 entry symbol doc spec)
1496 (while all
1497 (setq entry (car all)
1498 all (cdr all)
1499 symbol (nth 0 entry)
1500 doc (nth 1 entry)
1501 spec (nth 2 entry))
1502 (put symbol 'face-documentation doc)
1503 (put symbol 'face-defface-spec spec)))
1485 1504
1486 (provide 'faces) 1505 (provide 'faces)
1487 1506
1488 ;;; faces.el ends here 1507 ;;; faces.el ends here