diff options
| author | Richard M. Stallman | 1994-02-15 22:38:00 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-02-15 22:38:00 +0000 |
| commit | 6a588f9a70107f1bdcbfa033470418131b45c067 (patch) | |
| tree | 04db24523caa73c4b8dd2e971e67df2309f6917f | |
| parent | aa67090401dce28011053d3e30d6f5bbe7a91a9a (diff) | |
| download | emacs-6a588f9a70107f1bdcbfa033470418131b45c067.tar.gz emacs-6a588f9a70107f1bdcbfa033470418131b45c067.zip | |
(face-try-color-list): Don't rely on errors from using
a color that the server can't really support.
| -rw-r--r-- | lisp/faces.el | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/lisp/faces.el b/lisp/faces.el index 178a07ea3c2..0bc1ed0a777 100644 --- a/lisp/faces.el +++ b/lisp/faces.el | |||
| @@ -862,26 +862,34 @@ selected frame." | |||
| 862 | ;; That can't fail, so any subsequent elements after the t are ignored. | 862 | ;; That can't fail, so any subsequent elements after the t are ignored. |
| 863 | (defun face-try-color-list (function face colors frame) | 863 | (defun face-try-color-list (function face colors frame) |
| 864 | (if (stringp colors) | 864 | (if (stringp colors) |
| 865 | (funcall function face colors frame) | 865 | (if (or (and (not (x-display-color-p)) (not (string= colors "gray"))) |
| 866 | (= (x-display-planes) 1)) | ||
| 867 | nil | ||
| 868 | (funcall function face colors frame)) | ||
| 866 | (if (eq colors t) | 869 | (if (eq colors t) |
| 867 | (invert-face face frame) | 870 | (invert-face face frame) |
| 868 | (let (done) | 871 | (let (done) |
| 869 | (while (and colors (not done)) | 872 | (while (and colors (not done)) |
| 870 | (if (cdr colors) | 873 | (if (and (stringp (car colors)) |
| 871 | ;; If there are more colors to try, catch errors | 874 | (or (and (not (x-display-color-p)) |
| 872 | ;; and set `done' if we succeed. | 875 | (not (string= (car colors) "gray"))) |
| 873 | (condition-case nil | 876 | (= (x-display-planes) 1))) |
| 874 | (progn | 877 | nil |
| 875 | (if (eq (car colors) t) | 878 | (if (cdr colors) |
| 876 | (invert-face face frame) | 879 | ;; If there are more colors to try, catch errors |
| 877 | (funcall function face (car colors) frame)) | 880 | ;; and set `done' if we succeed. |
| 878 | (setq done t)) | 881 | (condition-case nil |
| 879 | (error nil)) | 882 | (progn |
| 880 | ;; If this is the last color, let the error get out if it fails. | 883 | (if (eq (car colors) t) |
| 881 | ;; If it succeeds, we will exit anyway after this iteration. | 884 | (invert-face face frame) |
| 882 | (if (eq (car colors) t) | 885 | (funcall function face (car colors) frame)) |
| 883 | (invert-face face frame) | 886 | (setq done t)) |
| 884 | (funcall function face (car colors) frame))) | 887 | (error nil)) |
| 888 | ;; If this is the last color, let the error get out if it fails. | ||
| 889 | ;; If it succeeds, we will exit anyway after this iteration. | ||
| 890 | (if (eq (car colors) t) | ||
| 891 | (invert-face face frame) | ||
| 892 | (funcall function face (car colors) frame)))) | ||
| 885 | (setq colors (cdr colors))))))) | 893 | (setq colors (cdr colors))))))) |
| 886 | 894 | ||
| 887 | ;; If we are already using x-window frames, initialize faces for them. | 895 | ;; If we are already using x-window frames, initialize faces for them. |