diff options
| author | Richard M. Stallman | 1997-09-02 19:59:11 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1997-09-02 19:59:11 +0000 |
| commit | 0351bce7c113e57bc817c8f99cb06e4f86a490cc (patch) | |
| tree | a4a88f8b70febd212e7c4477000717ce9a647e9d | |
| parent | 83e94c97e061d8c794b1475908342be2c4c13425 (diff) | |
| download | emacs-0351bce7c113e57bc817c8f99cb06e4f86a490cc.tar.gz emacs-0351bce7c113e57bc817c8f99cb06e4f86a490cc.zip | |
(facemenu-get-face): Just warn when given an
undefined color, no error, still return face.
| -rw-r--r-- | lisp/facemenu.el | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/lisp/facemenu.el b/lisp/facemenu.el index 35b7bb5a6fa..ba395e12930 100644 --- a/lisp/facemenu.el +++ b/lisp/facemenu.el | |||
| @@ -597,24 +597,27 @@ use the selected frame. If t, then the global, non-frame faces are used." | |||
| 597 | 597 | ||
| 598 | (defun facemenu-get-face (symbol) | 598 | (defun facemenu-get-face (symbol) |
| 599 | "Make sure FACE exists. | 599 | "Make sure FACE exists. |
| 600 | If not, it is created. If it is created and is of the form `fg:color', then | 600 | If not, create it and add it to the appropriate menu. Return the symbol. |
| 601 | set the foreground to that color. If of the form `bg:color', set the | 601 | |
| 602 | background. In any case, add it to the appropriate menu. Returns the face, | 602 | If a window system is in use, and this function creates a face named |
| 603 | or nil if given a bad color." | 603 | `fg:color', then it sets the foreground to that color. Likewise, `bg:color' |
| 604 | (if (or (internal-find-face symbol) | 604 | means to set the background. In either case, if the color is undefined, |
| 605 | (let* ((face (make-face symbol)) | 605 | no color is set and a warning is issued." |
| 606 | (name (symbol-name symbol)) | 606 | (let ((name (symbol-name symbol)) |
| 607 | foreground) | ||
| 608 | (cond ((internal-find-face symbol)) | ||
| 609 | ((and window-system | ||
| 610 | (or (setq foreground (string-match "^fg:" name)) | ||
| 611 | (string-match "^bg:" name))) | ||
| 612 | (let ((face (make-face symbol)) | ||
| 607 | (color (substring name 3))) | 613 | (color (substring name 3))) |
| 608 | (cond ((string-match "^fg:" name) | 614 | (if (x-color-defined-p color) |
| 609 | (set-face-foreground face color) | 615 | (if foreground |
| 610 | (and window-system | 616 | (set-face-foreground face color) |
| 611 | (x-color-defined-p color))) | 617 | (set-face-background face color)) |
| 612 | ((string-match "^bg:" name) | 618 | (message "Color \"%s\" undefined" color)))) |
| 613 | (set-face-background face color) | 619 | (t (make-face symbol)))) |
| 614 | (and window-system | 620 | symbol) |
| 615 | (x-color-defined-p color))) | ||
| 616 | (t)))) | ||
| 617 | symbol)) | ||
| 618 | 621 | ||
| 619 | (defun facemenu-add-new-face (face) | 622 | (defun facemenu-add-new-face (face) |
| 620 | "Add a FACE to the appropriate Face menu. | 623 | "Add a FACE to the appropriate Face menu. |