diff options
| author | Simon Marshall | 1995-12-13 15:31:07 +0000 |
|---|---|---|
| committer | Simon Marshall | 1995-12-13 15:31:07 +0000 |
| commit | 905cf8f2842374523cc18be98028cb5d58eb4a02 (patch) | |
| tree | 5597d98f28b1892a9a11055d0f4b97ff3bbca2ac | |
| parent | 4d4826ab5c67a7c27842d65486d5801de9a8a35c (diff) | |
| download | emacs-905cf8f2842374523cc18be98028cb5d58eb4a02.tar.gz emacs-905cf8f2842374523cc18be98028cb5d58eb4a02.zip | |
Take optional arg FRAME.
If flag not nil or t, don't change the attribute.
| -rw-r--r-- | lisp/faces.el | 77 |
1 files changed, 47 insertions, 30 deletions
diff --git a/lisp/faces.el b/lisp/faces.el index 2f8e3d9b3ec..cd20abb0f35 100644 --- a/lisp/faces.el +++ b/lisp/faces.el | |||
| @@ -203,33 +203,40 @@ in that frame; otherwise change each frame." | |||
| 203 | (t value)))) | 203 | (t value)))) |
| 204 | 204 | ||
| 205 | (defun modify-face (face foreground background stipple | 205 | (defun modify-face (face foreground background stipple |
| 206 | bold-p italic-p underline-p) | 206 | bold-p italic-p underline-p &optional frame) |
| 207 | "Change the display attributes for face FACE. | 207 | "Change the display attributes for face FACE. |
| 208 | FOREGROUND and BACKGROUND should be color strings or nil. | 208 | If the optional FRAME argument is provided, change only |
| 209 | STIPPLE should be a stipple pattern name or nil. | 209 | in that frame; otherwise change each frame. |
| 210 | |||
| 211 | FOREGROUND and BACKGROUND should be a colour name string (or list of strings to | ||
| 212 | try) or nil. STIPPLE should be a stipple pattern name string or nil. | ||
| 213 | If nil, means do not change the display attribute corresponding to that arg. | ||
| 214 | |||
| 210 | BOLD-P, ITALIC-P, and UNDERLINE-P specify whether the face should be set bold, | 215 | BOLD-P, ITALIC-P, and UNDERLINE-P specify whether the face should be set bold, |
| 211 | in italic, and underlined, respectively. (Yes if non-nil.) | 216 | in italic, and underlined, respectively. If neither nil or t, means do not |
| 212 | If called interactively, prompts for a face and face attributes." | 217 | change the display attribute corresponding to that arg. |
| 218 | |||
| 219 | If called interactively, prompts for a face name and face attributes." | ||
| 213 | (interactive | 220 | (interactive |
| 214 | (let* ((completion-ignore-case t) | 221 | (let* ((completion-ignore-case t) |
| 215 | (face (symbol-name (read-face-name "Modify face: "))) | 222 | (face (symbol-name (read-face-name "Modify face: "))) |
| 216 | (colors (mapcar 'list x-colors)) | 223 | (colors (mapcar 'list x-colors)) |
| 217 | (stipples (mapcar 'list | 224 | (stipples (mapcar 'list (apply 'nconc |
| 218 | (apply 'nconc | 225 | (mapcar 'directory-files |
| 219 | (mapcar 'directory-files | 226 | x-bitmap-file-path)))) |
| 220 | x-bitmap-file-path)))) | 227 | (foreground (modify-face-read-string |
| 221 | (foreground (modify-face-read-string | 228 | face (face-foreground (intern face)) |
| 222 | face (face-foreground (intern face)) | 229 | "foreground" colors)) |
| 223 | "foreground" colors)) | 230 | (background (modify-face-read-string |
| 224 | (background (modify-face-read-string | 231 | face (face-background (intern face)) |
| 225 | face (face-background (intern face)) | 232 | "background" colors)) |
| 226 | "background" colors)) | 233 | (stipple (modify-face-read-string |
| 227 | (stipple (modify-face-read-string | 234 | face (face-stipple (intern face)) |
| 228 | face (face-stipple (intern face)) | 235 | "stipple" stipples)) |
| 229 | "stipple" stipples)) | 236 | (bold-p (y-or-n-p (concat "Set face " face " bold "))) |
| 230 | (bold-p (y-or-n-p (concat "Set face " face " bold "))) | 237 | (italic-p (y-or-n-p (concat "Set face " face " italic "))) |
| 231 | (italic-p (y-or-n-p (concat "Set face " face " italic "))) | 238 | (underline-p (y-or-n-p (concat "Set face " face " underline "))) |
| 232 | (underline-p (y-or-n-p (concat "Set face " face " underline ")))) | 239 | (all-frames-p (y-or-n-p (concat "Modify face " face " in all frames ")))) |
| 233 | (message "Face %s: %s" face | 240 | (message "Face %s: %s" face |
| 234 | (mapconcat 'identity | 241 | (mapconcat 'identity |
| 235 | (delq nil | 242 | (delq nil |
| @@ -239,13 +246,23 @@ If called interactively, prompts for a face and face attributes." | |||
| 239 | (and bold-p "bold") (and italic-p "italic") | 246 | (and bold-p "bold") (and italic-p "italic") |
| 240 | (and underline-p "underline"))) ", ")) | 247 | (and underline-p "underline"))) ", ")) |
| 241 | (list (intern face) foreground background stipple | 248 | (list (intern face) foreground background stipple |
| 242 | bold-p italic-p underline-p))) | 249 | bold-p italic-p underline-p |
| 243 | (condition-case nil (set-face-foreground face foreground) (error nil)) | 250 | (if all-frames-p nil (selected-frame))))) |
| 244 | (condition-case nil (set-face-background face background) (error nil)) | 251 | (condition-case nil |
| 245 | (condition-case nil (set-face-stipple face stipple) (error nil)) | 252 | (face-try-color-list 'set-face-foreground face foreground frame) |
| 246 | (funcall (if bold-p 'make-face-bold 'make-face-unbold) face nil t) | 253 | (error nil)) |
| 247 | (funcall (if italic-p 'make-face-italic 'make-face-unitalic) face nil t) | 254 | (condition-case nil |
| 248 | (set-face-underline-p face underline-p) | 255 | (face-try-color-list 'set-face-background face background frame) |
| 256 | (error nil)) | ||
| 257 | (condition-case nil | ||
| 258 | (set-face-stipple face stipple frame) | ||
| 259 | (error nil)) | ||
| 260 | (cond ((eq bold-p nil) (make-face-unbold face frame t)) | ||
| 261 | ((eq bold-p t) (make-face-bold face frame t))) | ||
| 262 | (cond ((eq italic-p nil) (make-face-unitalic face frame t)) | ||
| 263 | ((eq italic-p t) (make-face-italic face frame t))) | ||
| 264 | (if (memq underline-p '(nil t)) | ||
| 265 | (set-face-underline-p face underline-p frame)) | ||
| 249 | (and (interactive-p) (redraw-display))) | 266 | (and (interactive-p) (redraw-display))) |
| 250 | 267 | ||
| 251 | ;;;; Associating face names (symbols) with their face vectors. | 268 | ;;;; Associating face names (symbols) with their face vectors. |