unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Drew Adams <drew.adams@oracle.com>
Cc: emacs-devel@gnu.org
Subject: Re: how to use graphic-display-p and window-system
Date: Sat, 18 Apr 2009 10:01:45 +0300	[thread overview]
Message-ID: <83vdp2igx2.fsf@gnu.org> (raw)
In-Reply-To: <000001c9bf99$47732600$0200a8c0@us.oracle.com>

> From: "Drew Adams" <drew.adams@oracle.com>
> Cc: <emacs-devel@gnu.org>
> 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
yet.




      parent reply	other threads:[~2009-04-18  7:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <m28wm31ock.fsf@nschum.de>
     [not found] ` <834owro4ha.fsf@gnu.org>
2009-04-17 17:37   ` how to use graphic-display-p and window-system Drew Adams
2009-04-17 18:15     ` Eli Zaretskii
2009-04-17 20:15       ` Drew Adams
2009-04-17 23:54         ` Stefan Monnier
2009-04-18  0:19           ` Drew Adams
2009-04-18  3:41             ` Stefan Monnier
2009-04-18  4:25               ` Drew Adams
2009-04-18  0:21           ` Miles Bader
2009-04-18  3:43             ` Stefan Monnier
2009-04-18  4:24               ` Drew Adams
2009-04-18  5:11               ` Miles Bader
2009-04-18  6:34           ` Eli Zaretskii
2009-04-18  7:01         ` Eli Zaretskii [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83vdp2igx2.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).