device-color-cells a pain

Bill Wohler <[email protected]> Wed, 22 Feb 2006 11:56:08 -0800
Newsgroups gmane.emacs.xemacs.general
Organization Newt Software
Message-ID <[email protected]>
In GNU Emacs, display-color-cells always returns a number. If you're
compiling, it returns 0. If you're running in a color tty, 8.

Unfortunately, I can't just alias this to device-color-cells on XEmacs
since device-color-cells returns nil when compiling or if running in a
color tty. This causes lots of (wrong-type-argument
number-char-or-marker-p nil) errors. (This seems like a bug to me.)

So, I need to write some code for the following:

(if (we're-on-a-display-that-makes-device-color-cells-behave-nicely)
    (device-color-cells)
  (some-other-function-that-returns-the-number-of-colors-but-never-nil))

Please suggest functions to replace the whimsical functions in the
pseudocode above. Thanks!

I Googled and found the following. I suppose I'll go with it unless I
hear of a better solution

  (or (device-color-cells) 2)

XEmacs 21.4.18.

p.s. I looked for, but did not find, a gmane.emacs.xemacs.user group.
Is this group its equivalent?

-- 
Bill Wohler <[email protected]>  http://www.newt.com/wohler/  GnuPG ID:610BD9AD
Maintainer of comp.mail.mh FAQ and MH-E. Vote Libertarian!
If you're passed on the right, you're in the wrong lane.