Re: device-color-cells a pain

"Stephen J. Turnbull" <[email protected]> Fri, 24 Feb 2006 20:40:27 +0900
Newsgroups gmane.emacs.xemacs.general
Organization The XEmacs Project
Message-ID <[email protected]>
>>>>> "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> Unfortunately, I can't just alias this to device-color-cells
    Bill> on XEmacs since device-color-cells returns nil when
    Bill> compiling

Why does device-color-cells return at all when compiling?  That sounds
like a bug in somebody's code to me.

    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.

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


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

comp.emacs.xemacs or [email protected].  The latter is supposed
to be bidirectionally gatewayed but I've never been able to get it to
work right.

-- 
School of Systems and Information Engineering http://turnbull.sk.tsukuba.ac.jp
University of Tsukuba                    Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
               Ask not how you can "do" free software business;
              ask what your business can "do for" free software.