diff options
| author | Richard M. Stallman | 1994-09-30 21:01:13 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-09-30 21:01:13 +0000 |
| commit | 1c0a87105971f441a55ae55454032f353bc67a01 (patch) | |
| tree | 478f53f8b8d786f6c9499fd99af43cefe06d0b50 /lisp | |
| parent | a4f5efdceaee151aa6430dd831edfeae168adce0 (diff) | |
| download | emacs-1c0a87105971f441a55ae55454032f353bc67a01.tar.gz emacs-1c0a87105971f441a55ae55454032f353bc67a01.zip | |
(modify-face): New function.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/faces.el | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/lisp/faces.el b/lisp/faces.el index 7beb5c2562f..0f38cb7a956 100644 --- a/lisp/faces.el +++ b/lisp/faces.el | |||
| @@ -128,7 +128,45 @@ If the optional FRAME argument is provided, change only | |||
| 128 | in that frame; otherwise change each frame." | 128 | in that frame; otherwise change each frame." |
| 129 | (interactive (internal-face-interactive "underline-p" "underlined")) | 129 | (interactive (internal-face-interactive "underline-p" "underlined")) |
| 130 | (internal-set-face-1 face 'underline underline-p 7 frame)) | 130 | (internal-set-face-1 face 'underline underline-p 7 frame)) |
| 131 | 131 | ||
| 132 | (defun modify-face (face foreground background bold-p italic-p underline-p) | ||
| 133 | "Change the display attributes for face FACE. | ||
| 134 | FOREGROUND and BACKGROUND should be color strings. (Default color if nil.) | ||
| 135 | BOLD-P, ITALIC-P, and UNDERLINE-P specify whether the face should be set bold, | ||
| 136 | in italic, and underlined, respectively. (Yes if non-nil.) | ||
| 137 | If called interactively, prompts for a face and face attributes." | ||
| 138 | (interactive | ||
| 139 | (let* ((completion-ignore-case t) | ||
| 140 | (face (symbol-name (read-face-name "Face: "))) | ||
| 141 | (foreground (completing-read | ||
| 142 | (format "Face %s set foreground (default %s): " face | ||
| 143 | (downcase (or (face-foreground (intern face)) | ||
| 144 | "foreground"))) | ||
| 145 | (mapcar 'list (x-defined-colors)))) | ||
| 146 | (background (completing-read | ||
| 147 | (format "Face %s set background (default %s): " face | ||
| 148 | (downcase (or (face-background (intern face)) | ||
| 149 | "background"))) | ||
| 150 | (mapcar 'list (x-defined-colors)))) | ||
| 151 | (bold-p (y-or-n-p (concat "Face " face ": set bold "))) | ||
| 152 | (italic-p (y-or-n-p (concat "Face " face ": set italic "))) | ||
| 153 | (underline-p (y-or-n-p (concat "Face " face ": set underline ")))) | ||
| 154 | (if (string-equal background "") (setq background nil)) | ||
| 155 | (if (string-equal foreground "") (setq foreground nil)) | ||
| 156 | (message "Face %s: %s" face | ||
| 157 | (mapconcat 'identity | ||
| 158 | (delq nil | ||
| 159 | (list (and foreground (concat (downcase foreground) " foreground")) | ||
| 160 | (and background (concat (downcase background) " background")) | ||
| 161 | (and bold-p "bold") (and italic-p "italic") | ||
| 162 | (and underline-p "underline"))) ", ")) | ||
| 163 | (list (intern face) foreground background bold-p italic-p underline-p))) | ||
| 164 | (condition-case nil (set-face-foreground face foreground) (error nil)) | ||
| 165 | (condition-case nil (set-face-background face background) (error nil)) | ||
| 166 | (funcall (if bold-p 'make-face-bold 'make-face-unbold) face nil t) | ||
| 167 | (funcall (if italic-p 'make-face-italic 'make-face-unitalic) face nil t) | ||
| 168 | (set-face-underline-p face underline-p) | ||
| 169 | (and (interactive-p) (redraw-display))) | ||
| 132 | 170 | ||
| 133 | ;;;; Associating face names (symbols) with their face vectors. | 171 | ;;;; Associating face names (symbols) with their face vectors. |
| 134 | 172 | ||