summaryrefslogtreecommitdiff
path: root/lisp/faces.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1994-02-15 22:38:00 +0000
committerRichard M. Stallman <rms@gnu.org>1994-02-15 22:38:00 +0000
commit6a588f9a70107f1bdcbfa033470418131b45c067 (patch)
tree04db24523caa73c4b8dd2e971e67df2309f6917f /lisp/faces.el
parentaa67090401dce28011053d3e30d6f5bbe7a91a9a (diff)
downloademacs-6a588f9a70107f1bdcbfa033470418131b45c067.tar.gz
(face-try-color-list): Don't rely on errors from using
a color that the server can't really support.
Diffstat (limited to 'lisp/faces.el')
-rw-r--r--lisp/faces.el40
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."
;; That can't fail, so any subsequent elements after the t are ignored.
(defun face-try-color-list (function face colors frame)
(if (stringp colors)
- (funcall function face colors frame)
+ (if (or (and (not (x-display-color-p)) (not (string= colors "gray")))
+ (= (x-display-planes) 1))
+ nil
+ (funcall function face colors frame))
(if (eq colors t)
(invert-face face frame)
(let (done)
(while (and colors (not done))
- (if (cdr colors)
- ;; If there are more colors to try, catch errors
- ;; and set `done' if we succeed.
- (condition-case nil
- (progn
- (if (eq (car colors) t)
- (invert-face face frame)
- (funcall function face (car colors) frame))
- (setq done t))
- (error nil))
- ;; If this is the last color, let the error get out if it fails.
- ;; If it succeeds, we will exit anyway after this iteration.
- (if (eq (car colors) t)
- (invert-face face frame)
- (funcall function face (car colors) frame)))
+ (if (and (stringp (car colors))
+ (or (and (not (x-display-color-p))
+ (not (string= (car colors) "gray")))
+ (= (x-display-planes) 1)))
+ nil
+ (if (cdr colors)
+ ;; If there are more colors to try, catch errors
+ ;; and set `done' if we succeed.
+ (condition-case nil
+ (progn
+ (if (eq (car colors) t)
+ (invert-face face frame)
+ (funcall function face (car colors) frame))
+ (setq done t))
+ (error nil))
+ ;; If this is the last color, let the error get out if it fails.
+ ;; If it succeeds, we will exit anyway after this iteration.
+ (if (eq (car colors) t)
+ (invert-face face frame)
+ (funcall function face (car colors) frame))))
(setq colors (cdr colors)))))))
;; If we are already using x-window frames, initialize faces for them.