[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: Fri, 17 Apr 2009 21:15:19 +0300

> From: "Drew Adams" <address@hidden>
> Date: Fri, 17 Apr 2009 10:37:45 -0700
> > You mean, on graphic displays. Please use `display-graphic-p' 
> > rather than assuming that if `window-system' is non-nil, the 
> > display is necessarily a graphic one. At least one Emacs 
> > configuration violates this assumption.
> I'm not familiar with `display-graphic-p'. I've been using `window-system' to
> distinguish Emacs running in a console/terminal from Emacs running with a 
> window
> mgr.

Well, I learn something new now and then.  Sounds like today's your
turn ;-)

> In particular, I want to check whether Emacs supports keys such as S-TAB.

That's totally unrelated to window-system or the display being
graphic.  For example, on MS-Windows, S-TAB is supported even under
"-nw", where window-system and display-graphic-p are both nil.

> [Excuse me if console/terminal is not the right terminology, but I'm talking
> about Emacs with no fancy keys such as S-TAB and less graphic support (colors,
> fonts etc.) versus Emacs with no such limitations.]

Colors nowadays are also orthogonal to window-system and
display-graphic-p: for example, there's the 256-color xterm, where the
number of colors is indistinguishable from a GUI display, but
window-system is nil and so is what display-graphic-p returns.

> `display-graphic-p' has apparently been with us since Emacs 22, but there is 
> no
> mention of it in the Elisp manual, even in Emacs 23.

??? Are you looking at a stale ELisp manual, perhaps?  I typed
"i display-graphic-p RET" and landed in a node named "Display Feature
Testing" that documents this predicate.  This documentation exists
since the day the predicate itself was added to Emacs (which, btw, was
during Emacs 21 development, not since Emacs 22).

> Could someone please summarize the differences between the two, and when to 
> use
> one or the other?

The only situation I know of where use of window-system is justified
is when you want to distinguish between the different kinds of window
systems, like between X and MS-Windows.  In all other cases, you are
well advised to use the APIs documented in the above-mentioned node of
the ELisp manual.

As for testing whether ``fancy'' keys are supported, I don't know how
to do that in Emacs.  Maybe someone else can suggest a way.  But
window-system is certainly not the way of doing that in a portable

reply via email to

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