Mercurial > emacs
comparison lisp/faces.el @ 37467:342409bb6b91
(modify-face): Add compatibility for non-interactive use.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Wed, 25 Apr 2001 15:22:44 +0000 |
parents | 2a5e646c5174 |
children | 39d5cdb9b9af |
comparison
equal
deleted
inserted
replaced
37466:b34360318552 | 37467:342409bb6b91 |
---|---|
964 (setq result (cons (car attribute) | 964 (setq result (cons (car attribute) |
965 (cons (read-face-attribute face (car attribute) frame) | 965 (cons (read-face-attribute face (car attribute) frame) |
966 result)))))) | 966 result)))))) |
967 | 967 |
968 | 968 |
969 (defun modify-face (&optional frame) | 969 (defun modify-face (&optional face foreground background stipple |
970 bold-p italic-p underline-p inverse-p frame) | |
970 "Modify attributes of faces interactively. | 971 "Modify attributes of faces interactively. |
971 If optional argument FRAME is nil or omitted, modify the face used | 972 If optional argument FRAME is nil or omitted, modify the face used |
972 for newly created frame, i.e. the global face." | 973 for newly created frame, i.e. the global face. |
974 For non-interactive use, `set-face-attribute' is preferred. | |
975 When called from elisp, if FACE is nil, all arguments but FRAME are ignored | |
976 and the face and its settings are obtained by querying the user." | |
973 (interactive) | 977 (interactive) |
974 (let ((face (read-face-name "Modify face"))) | 978 (if face |
979 (set-face-attribute face frame | |
980 :foreground (or foreground 'unspecified) | |
981 :background (or background 'unspecified) | |
982 :stipple stipple | |
983 :bold bold-p | |
984 :italic italic-p | |
985 :underline underline-p | |
986 :inverse-video inverse-p) | |
987 (setq face (read-face-name "Modify face")) | |
975 (apply #'set-face-attribute face frame | 988 (apply #'set-face-attribute face frame |
976 (read-all-face-attributes face frame)))) | 989 (read-all-face-attributes face frame)))) |
977 | |
978 | 990 |
979 (defun read-face-and-attribute (attribute &optional frame) | 991 (defun read-face-and-attribute (attribute &optional frame) |
980 "Read face name and face attribute value. | 992 "Read face name and face attribute value. |
981 ATTRIBUTE is the attribute whose new value is read. | 993 ATTRIBUTE is the attribute whose new value is read. |
982 FRAME nil or unspecified means read attribute value of global face. | 994 FRAME nil or unspecified means read attribute value of global face. |
983 Value is a list (FACE NEW-VALUE) where FACE is the face read | 995 Value is a list (FACE NEW-VALUE) where FACE is the face read |
984 (a symbol), and NEW-VALUE is value read." | 996 \(a symbol), and NEW-VALUE is value read." |
985 (cond ((eq attribute :font) | 997 (cond ((eq attribute :font) |
986 (let* ((prompt "Set font-related attributes of face") | 998 (let* ((prompt "Set font-related attributes of face") |
987 (face (read-face-name prompt)) | 999 (face (read-face-name prompt)) |
988 (font (read-face-font face frame))) | 1000 (font (read-face-font face frame))) |
989 (list face font))) | 1001 (list face font))) |
1271 If there is no default for FACE, return nil." | 1283 If there is no default for FACE, return nil." |
1272 (get face 'face-defface-spec)) | 1284 (get face 'face-defface-spec)) |
1273 | 1285 |
1274 (defsubst face-user-default-spec (face) | 1286 (defsubst face-user-default-spec (face) |
1275 "Return the user's customized face-spec for FACE, or the default if none. | 1287 "Return the user's customized face-spec for FACE, or the default if none. |
1276 If there is neither a user setting or a default for FACE, return nil." | 1288 If there is neither a user setting nor a default for FACE, return nil." |
1277 (or (get face 'saved-face) | 1289 (or (get face 'saved-face) |
1278 (face-default-spec face))) | 1290 (face-default-spec face))) |
1279 | 1291 |
1280 | 1292 |
1281 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 1293 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |