diff lisp/mh-e/mh-init.el @ 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 7882fc7df359
children bbc0e52abce5
line wrap: on
line diff
--- 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)