[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to use graphic-display-p and window-system

From: Eli Zaretskii
Subject: Re: how to use graphic-display-p and window-system
Date: Sat, 18 Apr 2009 10:01:45 +0300

> From: "Drew Adams" <address@hidden>
> Cc: <address@hidden>
> Date: Fri, 17 Apr 2009 13:15:36 -0700
> See also below - it seems like the Emacs source code generally uses
> `window-system' to test for such keys. That's my first impression, but you say
> it is "totally unrelated", so I wonder.

It's a coincidence.  Most window-systems support most ``fancy''
characters.  What to make of that is up to you.

> Perhaps there are platform-specific details or exceptions, but I'm looking 
> for a
> general test that is platform-independent, even if that means it might not be
> 100% reliable. I'm not going to test each platform with each
> console-vs-graphics-display combination or with each possible key sequence.

Then perhaps you should ask about specific keys.  Your original mail
sounded like you wanted a general-purpose, 100% correct test, but now
you say you just want some plausible heuristics.  It's hard to tell
what is the answer without knowing the specifics of what is and what
isn't important for you.

> Can you use more or less arbitrary #RRRGRRBBB codes, or are you
> limited to, say, 256 colors?

Yes, you can; see tty-color-translate.  Emacs uses that automatically
when you specify colors on a TTY, and the result on an 88-color or a
256-color TTY is generally indistinguishable from what you get on X or
any other windowing system with much more colors.

> Again, if neither `window-system' nor `display-graphic-p' addresses such a
> distinction, then what does? Will `display-color-p' make this distinction?

No.  Use display-color-cells, which returns the number of colors the
frame's display can support.  Emacs in general treats any display with
88 colors or more as full-color capable, because the human eye cannot
tell the difference.

> There might of course be some out-of-date uses of `window-system' in the Emacs
> 23 source code. Dunno. In any case, there are plenty of tests using
> `window-system' that seem to determine handling of colors and other face
> qualities, character glyphs, and fonts.

They should all be switched to using the APIs documented in "Display
Feature Testing" in the ELisp manual.

> There is also a comment indicating that a particular use of `window-system'
> needs to be fixed to use `display-graphic-p', but that this cannot be done
> until:
> ;; color selection depends on the number of supported colors,
> ;; and all defface's are changed to look at number of colors
> ;; instead of (type graphic) etc.

This is already done, so that code could be fixed.

> These things make me wonder if we are perhaps still between two chairs wrt
> color-support tests.

We are not between two chairs, we just didn't fix all those places

reply via email to

[Prev in Thread] Current Thread [Next in Thread]