From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: how to use graphic-display-p and window-system Date: Sat, 18 Apr 2009 10:01:45 +0300 Message-ID: <83vdp2igx2.fsf@gnu.org> References: <834owro4ha.fsf@gnu.org> <001a01c9bf83$38bd2270$0200a8c0@us.oracle.com> <83d4bbjgeg.fsf@gnu.org> <000001c9bf99$47732600$0200a8c0@us.oracle.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: ger.gmane.org 1240038136 10449 80.91.229.12 (18 Apr 2009 07:02:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 18 Apr 2009 07:02:16 +0000 (UTC) Cc: emacs-devel@gnu.org To: Drew Adams Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 18 09:03:34 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Lv4aI-0003l9-H0 for ged-emacs-devel@m.gmane.org; Sat, 18 Apr 2009 09:03:30 +0200 Original-Received: from localhost ([127.0.0.1]:49369 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lv4Yt-00011b-R7 for ged-emacs-devel@m.gmane.org; Sat, 18 Apr 2009 03:02:03 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lv4Ye-0000x6-78 for emacs-devel@gnu.org; Sat, 18 Apr 2009 03:01:48 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lv4Yd-0000wq-KN for emacs-devel@gnu.org; Sat, 18 Apr 2009 03:01:47 -0400 Original-Received: from [199.232.76.173] (port=57993 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lv4Yd-0000wl-EU for emacs-devel@gnu.org; Sat, 18 Apr 2009 03:01:47 -0400 Original-Received: from mx20.gnu.org ([199.232.41.8]:37743) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Lv4Yc-0003PA-NQ for emacs-devel@gnu.org; Sat, 18 Apr 2009 03:01:46 -0400 Original-Received: from mtaout6.012.net.il ([84.95.2.16]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Lv4Yc-0006NZ-2l for emacs-devel@gnu.org; Sat, 18 Apr 2009 03:01:46 -0400 Original-Received: from conversion-daemon.i-mtaout6.012.net.il by i-mtaout6.012.net.il (HyperSendmail v2007.08) id <0KIA00I00BFMHO00@i-mtaout6.012.net.il> for emacs-devel@gnu.org; Sat, 18 Apr 2009 10:01:44 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([77.124.144.191]) by i-mtaout6.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0KIA007R8BIV1860@i-mtaout6.012.net.il>; Sat, 18 Apr 2009 10:01:44 +0300 (IDT) In-reply-to: <000001c9bf99$47732600$0200a8c0@us.oracle.com> X-012-Sender: halo1@inter.net.il X-detected-kernel: by mx20.gnu.org: Solaris 10 (1203?) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:110342 Archived-At: > From: "Drew Adams" > Cc: > 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.