summaryrefslogtreecommitdiff
path: root/lisp/faces.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2001-04-25 15:22:44 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2001-04-25 15:22:44 +0000
commitd1092ca8227cacdc6cede9d4e2833383cee1609a (patch)
tree46c3ddc3af99dccef89eab21c163b2e042020af5 /lisp/faces.el
parenta74ab54212904ceda1d927f35f615e228bb1db1a (diff)
downloademacs-d1092ca8227cacdc6cede9d4e2833383cee1609a.tar.gz
(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."
result))))))
-(defun modify-face (&optional frame)
+(defun modify-face (&optional face foreground background stipple
+ bold-p italic-p underline-p inverse-p frame)
"Modify attributes of faces interactively.
If optional argument FRAME is nil or omitted, modify the face used
-for newly created frame, i.e. the global face."
+for newly created frame, i.e. the global face.
+For non-interactive use, `set-face-attribute' is preferred.
+When called from elisp, if FACE is nil, all arguments but FRAME are ignored
+and the face and its settings are obtained by querying the user."
(interactive)
- (let ((face (read-face-name "Modify face")))
+ (if face
+ (set-face-attribute face frame
+ :foreground (or foreground 'unspecified)
+ :background (or background 'unspecified)
+ :stipple stipple
+ :bold bold-p
+ :italic italic-p
+ :underline underline-p
+ :inverse-video inverse-p)
+ (setq face (read-face-name "Modify face"))
(apply #'set-face-attribute face frame
(read-all-face-attributes face frame))))
-
(defun read-face-and-attribute (attribute &optional frame)
"Read face name and face attribute value.
ATTRIBUTE is the attribute whose new value is read.
FRAME nil or unspecified means read attribute value of global face.
Value is a list (FACE NEW-VALUE) where FACE is the face read
-(a symbol), and NEW-VALUE is value read."
+\(a symbol), and NEW-VALUE is value read."
(cond ((eq attribute :font)
(let* ((prompt "Set font-related attributes of face")
(face (read-face-name prompt))
@@ -1273,7 +1285,7 @@ If there is no default for FACE, return nil."
(defsubst face-user-default-spec (face)
"Return the user's customized face-spec for FACE, or the default if none.
-If there is neither a user setting or a default for FACE, return nil."
+If there is neither a user setting nor a default for FACE, return nil."
(or (get face 'saved-face)
(face-default-spec face)))