Re: device-color-cells a pain

Bill Wohler <[email protected]> Fri, 24 Feb 2006 10:28:43 -0800
Newsgroups gmane.emacs.xemacs.general
Organization Newt Software
Message-ID <[email protected]>
Stephen J. Turnbull <[email protected]> wrote:

> >>>>> "Bill" == Bill Wohler <[email protected]> writes:
> 
>     Bill> In GNU Emacs, display-color-cells always returns a
>     Bill> number. If you're compiling, it returns 0.
> 
> That's a plausible heuristic, but I wouldn't bet on it always working
> properly.
> 
>     Bill> If you're running in a color tty, 8.
> 
> That's not.  There are plenty of TTYs that do more than 8 colors.
>
>     Bill> or if running in a color tty. This causes lots of
>     Bill> (wrong-type-argument number-char-or-marker-p nil)
>     Bill> errors. (This seems like a bug to me.)
> 
> I disagree.  You (and GNU Emacs) may be willing to impose a fixed
> limit of 8 colors on color TTY users, but if so I think you should
> make that decision explicitly, rather than ask XEmacs to do it.

Sorry if I wasn't clear. I wasn't stating the actual heuristic, just my
personal observation.

>     Bill> I Googled and found the following. I suppose I'll go with it
>     Bill> unless I hear of a better solution
> 
>     Bill>   (or (device-color-cells) 2)
> 
> (defcustom package-color-tty-color-cells 2
>   "Number of color cells to assume on color TTYs."
>:group 'package
>:type number)
> 
> (defun package-device-color-cells (&optional device)
>   "See `device-color-cells' and `package-color-tty-color-cells'."
>   (or (device-color-cells device) package-color-tty-color-cells))

Thanks. Unfortunately, these don't seem to be in 21.4.18. It seems to me
that putting this logic in device-color-cells in the first place would
avoid these problems.

-- 
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.