aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/faces.el
diff options
context:
space:
mode:
authorStefan Monnier2001-04-25 15:22:53 +0000
committerStefan Monnier2001-04-25 15:22:53 +0000
commit7cd512f22f12d22e29a35aafceab613e5aefadee (patch)
treef10bcc43aab6e144d5a9fe4a0b712f8ceb8df98c /lisp/faces.el
parentc88164fe6b832249d756929837acf949de6f8a8c (diff)
downloademacs-7cd512f22f12d22e29a35aafceab613e5aefadee.tar.gz
emacs-7cd512f22f12d22e29a35aafceab613e5aefadee.zip
(modify-face): Add compatibility for non-interactive use.
Diffstat (limited to 'lisp/faces.el')
-rw-r--r--lisp/faces.el24
1 files changed, 18 insertions, 6 deletions
diff --git a/lisp/faces.el b/lisp/faces.el
index 67576035930..d27da784bf1 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -966,22 +966,34 @@ Value is a property list of attribute names and new values."
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.
971If optional argument FRAME is nil or omitted, modify the face used 972If optional argument FRAME is nil or omitted, modify the face used
972for newly created frame, i.e. the global face." 973for newly created frame, i.e. the global face.
974For non-interactive use, `set-face-attribute' is preferred.
975When called from elisp, if FACE is nil, all arguments but FRAME are ignored
976and 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 990
978
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.
981ATTRIBUTE is the attribute whose new value is read. 993ATTRIBUTE is the attribute whose new value is read.
982FRAME nil or unspecified means read attribute value of global face. 994FRAME nil or unspecified means read attribute value of global face.
983Value is a list (FACE NEW-VALUE) where FACE is the face read 995Value 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))
@@ -1273,7 +1285,7 @@ If there is no default for FACE, return nil."
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.
1276If there is neither a user setting or a default for FACE, return nil." 1288If 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