diff options
| author | Stefan Monnier | 2001-04-25 15:22:53 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2001-04-25 15:22:53 +0000 |
| commit | 7cd512f22f12d22e29a35aafceab613e5aefadee (patch) | |
| tree | f10bcc43aab6e144d5a9fe4a0b712f8ceb8df98c /lisp/faces.el | |
| parent | c88164fe6b832249d756929837acf949de6f8a8c (diff) | |
| download | emacs-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.el | 24 |
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. |
| 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 | 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. |
| 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)) |
| @@ -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. |
| 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 | ||