changeset 68000:830e95c83d49

* mh-customize.el (mh-folder-msg-number): Snow is actually off-white on low color displays which turns to white when bold. This is unreadable on white backgrounds. Use snow with min-colors requirement. Use cyan on low-color displays. * mh-init.el (mh-defface-compat): On low-color displays, delete the high-color display rather than simply strip the min-colors requirement since the existing algorithm shadowed the desired display on low-color displays.
author Bill Wohler <wohler@newt.com>
date Tue, 03 Jan 2006 18:25:26 +0000
parents 08bdaa28d0d2
children 8e733b93ffdc
files lisp/mh-e/ChangeLog lisp/mh-e/mh-customize.el lisp/mh-e/mh-init.el
diffstat 3 files changed, 43 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mh-e/ChangeLog	Tue Jan 03 18:20:20 2006 +0000
+++ b/lisp/mh-e/ChangeLog	Tue Jan 03 18:25:26 2006 +0000
@@ -1,5 +1,15 @@
 2006-01-03  Bill Wohler  <wohler@newt.com>
 
+	* mh-customize.el (mh-folder-msg-number): Snow is actually
+	off-white on low color displays which turns to white when bold.
+	This is unreadable on white backgrounds. Use snow with min-colors
+	requirement. Use cyan on low-color displays.
+
+	* mh-init.el (mh-defface-compat): On low-color displays, delete
+	the high-color display rather than simply strip the min-colors
+	requirement since the existing algorithm shadowed the desired
+	display on low-color displays.
+
 	* mh-alias.el (mh-alias-add-alias): Remove leading * from
 	docstring.
 
--- a/lisp/mh-e/mh-customize.el	Tue Jan 03 18:20:20 2006 +0000
+++ b/lisp/mh-e/mh-customize.el	Tue Jan 03 18:25:26 2006 +0000
@@ -2536,10 +2536,14 @@
   :group 'mh-folder)
 
 (defface mh-folder-msg-number
-  '((((class color) (background light))
-     (:foreground "snow4"))
-    (((class color) (background dark))
-     (:foreground "snow3")))
+  (mh-defface-compat
+   '((((class color) (min-colors 88) (background light))
+      (:foreground "snow4"))
+     (((class color) (min-colors 88) (background dark))
+      (:foreground "snow3"))
+     (((class color))
+      (:foreground "cyan"))))
+    
   "Message number face."
   :group 'mh-faces
   :group 'mh-folder)
@@ -2876,7 +2880,9 @@
     '((((class color) (background light))
        (:foreground "snow4"))
       (((class color) (background dark))
-       (:foreground "snow3")))))
+       (:foreground "snow3"))
+      (((class color))
+       (:foreground "cyan")))))
 
 
 ;; Local Variables:
--- a/lisp/mh-e/mh-init.el	Tue Jan 03 18:20:20 2006 +0000
+++ b/lisp/mh-e/mh-init.el	Tue Jan 03 18:25:26 2006 +0000
@@ -336,23 +336,28 @@
   "Convert SPEC for defface if necessary to run on older platforms.
 Modifies SPEC in place and returns it. See `defface' for the spec definition.
 
-When `mh-min-colors-defined-flag' is nil, this function finds a
-display with a single \"class\" requirement with a \"color\"
-item, renames the requirement to \"tty\" and moves it to the
-beginning of the list. It then strips any \"min-colors\"
-requirements."
-  (when (not mh-min-colors-defined-flag)
-    ;; Insert ((class tty)) display with ((class color)) attributes.
-    (let ((attributes (cdr (assoc '((class color)) spec))))
-      (cons (cons '((class tty)) attributes) spec))
-    ;; Delete ((class color)) display.
-    (delq (assoc '((class color)) spec) spec)
-    ;; Strip min-colors.
-    (loop for entry in spec do
-          (when (not (eq (car entry) t))
-            (if (assoc 'min-colors (car entry))
-                (delq (assoc 'min-colors (car entry)) (car entry))))))
-  spec)
+When `mh-min-colors-defined-flag' is nil, this function finds
+display entries with \"min-colors\" requirements and either
+removes the \"min-colors\" requirement or strips the display
+entirely if the display does not support the number of specified
+colors."
+  (if mh-min-colors-defined-flag
+      spec
+    (let ((cells (display-color-cells))
+          new-spec)
+      ;; Remove entries with min-colors, or delete them if we have fewer colors
+      ;; than they specify.
+      (loop for entry in (reverse spec) do
+            (let ((requirement (if (eq (car entry) t)
+                                   nil
+                                 (assoc 'min-colors (car entry)))))
+              (if requirement
+                  (when (>= cells (nth 1 requirement))
+                    (setq new-spec (cons (cons (delq requirement (car entry))
+                                               (cdr entry))
+                                         new-spec)))
+                (setq new-spec (cons entry new-spec)))))
+      new-spec)))
 
 (provide 'mh-init)