diff options
| author | Richard M. Stallman | 1996-08-19 16:31:27 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-08-19 16:31:27 +0000 |
| commit | 3c5ddb48c40fcf125d5b42932fb7cf2453314595 (patch) | |
| tree | 2037e9e64d6dd9c10fab647a124790784d5b2f17 | |
| parent | 1bc5a00450cfa36b556154d6a800001a12562979 (diff) | |
| download | emacs-3c5ddb48c40fcf125d5b42932fb7cf2453314595.tar.gz emacs-3c5ddb48c40fcf125d5b42932fb7cf2453314595.zip | |
(modify-face): Handle nil as stipple value.
(internal-face-interactive-stipple): New function.
(set-face-stipple): Use internal-face-interactive-stipple.
| -rw-r--r-- | lisp/faces.el | 47 |
1 files changed, 38 insertions, 9 deletions
diff --git a/lisp/faces.el b/lisp/faces.el index d5cb0e5a6eb..8c199fcfb70 100644 --- a/lisp/faces.el +++ b/lisp/faces.el | |||
| @@ -178,7 +178,7 @@ and DATA is a string, containing the raw bits of the bitmap. | |||
| 178 | 178 | ||
| 179 | If the optional FRAME argument is provided, change only | 179 | If the optional FRAME argument is provided, change only |
| 180 | in that frame; otherwise change each frame." | 180 | in that frame; otherwise change each frame." |
| 181 | (interactive (internal-face-interactive "stipple")) | 181 | (interactive (internal-face-interactive-stipple "stipple")) |
| 182 | (internal-set-face-1 face 'background-pixmap pixmap 6 frame)) | 182 | (internal-set-face-1 face 'background-pixmap pixmap 6 frame)) |
| 183 | 183 | ||
| 184 | (defalias 'set-face-background-pixmap 'set-face-stipple) | 184 | (defalias 'set-face-background-pixmap 'set-face-stipple) |
| @@ -237,7 +237,8 @@ If called interactively, prompts for a face name and face attributes." | |||
| 237 | (old-stipple-string | 237 | (old-stipple-string |
| 238 | (if (stringp (face-stipple (intern face))) | 238 | (if (stringp (face-stipple (intern face))) |
| 239 | (face-stipple (intern face)) | 239 | (face-stipple (intern face)) |
| 240 | (prin1-to-string (face-stipple (intern face))))) | 240 | (if (face-stipple (intern face)) |
| 241 | (prin1-to-string (face-stipple (intern face)))))) | ||
| 241 | (new-stipple-string | 242 | (new-stipple-string |
| 242 | (modify-face-read-string | 243 | (modify-face-read-string |
| 243 | face old-stipple-string | 244 | face old-stipple-string |
| @@ -247,12 +248,13 @@ If called interactively, prompts for a face name and face attributes." | |||
| 247 | ;; This makes the assumption that a pixmap file name | 248 | ;; This makes the assumption that a pixmap file name |
| 248 | ;; won't start with an open-paren. | 249 | ;; won't start with an open-paren. |
| 249 | (stipple | 250 | (stipple |
| 250 | (if (string-match "^(" new-stipple-string) | 251 | (and new-stipple-string |
| 251 | (read new-stipple-string) | 252 | (if (string-match "^(" new-stipple-string) |
| 252 | new-stipple-string)) | 253 | (read new-stipple-string) |
| 253 | (bold-p (y-or-n-p (concat "Set face " face " bold "))) | 254 | new-stipple-string))) |
| 254 | (italic-p (y-or-n-p (concat "Set face " face " italic "))) | 255 | (bold-p (y-or-n-p (concat "Should face " face " be bold "))) |
| 255 | (underline-p (y-or-n-p (concat "Set face " face " underline "))) | 256 | (italic-p (y-or-n-p (concat "Should face " face " be italic "))) |
| 257 | (underline-p (y-or-n-p (concat "Should face " face " be underlined "))) | ||
| 256 | (all-frames-p (y-or-n-p (concat "Modify face " face " in all frames ")))) | 258 | (all-frames-p (y-or-n-p (concat "Modify face " face " in all frames ")))) |
| 257 | (message "Face %s: %s" face | 259 | (message "Face %s: %s" face |
| 258 | (mapconcat 'identity | 260 | (mapconcat 'identity |
| @@ -357,7 +359,34 @@ If NAME is already a face, it is simply returned." | |||
| 357 | default)))) | 359 | default)))) |
| 358 | (list face (if (equal value "") nil value)))) | 360 | (list face (if (equal value "") nil value)))) |
| 359 | 361 | ||
| 360 | 362 | (defun internal-face-interactive-stipple (what) | |
| 363 | (let* ((fn (intern (concat "face-" what))) | ||
| 364 | (prompt (concat "Set " what " of face")) | ||
| 365 | (face (read-face-name (concat prompt ": "))) | ||
| 366 | (default (if (fboundp fn) | ||
| 367 | (or (funcall fn face (selected-frame)) | ||
| 368 | (funcall fn 'default (selected-frame))))) | ||
| 369 | ;; If the stipple value is a list (WIDTH HEIGHT DATA), | ||
| 370 | ;; represent that as a string by printing it out. | ||
| 371 | (old-stipple-string | ||
| 372 | (if (stringp (face-stipple face)) | ||
| 373 | (face-stipple face) | ||
| 374 | (if (null (face-stipple face)) | ||
| 375 | nil | ||
| 376 | (prin1-to-string (face-stipple face))))) | ||
| 377 | (new-stipple-string | ||
| 378 | (read-string | ||
| 379 | (concat prompt " " (symbol-name face) " to: ") | ||
| 380 | old-stipple-string)) | ||
| 381 | ;; Convert the stipple value text we read | ||
| 382 | ;; back to a list if it looks like one. | ||
| 383 | ;; This makes the assumption that a pixmap file name | ||
| 384 | ;; won't start with an open-paren. | ||
| 385 | (stipple | ||
| 386 | (if (string-match "^(" new-stipple-string) | ||
| 387 | (read new-stipple-string) | ||
| 388 | new-stipple-string))) | ||
| 389 | (list face (if (equal stipple "") nil stipple)))) | ||
| 361 | 390 | ||
| 362 | (defun make-face (name) | 391 | (defun make-face (name) |
| 363 | "Define a new FACE on all frames. | 392 | "Define a new FACE on all frames. |