emacs-devel
[Top][All Lists]
Advanced

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

Re: `emacs -nw', `framep' returning `t', `display-graphic-p' returning `


From: Eli Zaretskii
Subject: Re: `emacs -nw', `framep' returning `t', `display-graphic-p' returning `nil'
Date: Sun, 17 Dec 2017 19:34:39 +0200

> Date: Sun, 17 Dec 2017 09:10:00 -0800 (PST)
> From: Drew Adams <address@hidden>
> 
> Searching a bit more, I see that `framep' returns plain `t'
> "for a termcap frame (a character-only terminal)".  And the
> user with this problem (in spite of non-nil `display-graphic-p')
> does indeed get `t' for `(framep (selected-frame))'.
> 
> So my next attempt will likely be to use that instead of
> `display-graphic-p'.
> 
> Before I try that, can someone please point out what I'm missing?
> 
> The doc for both `framep' and `display-graphic-p' seems to say
> that the former returns `t' for a " a character-only terminal",
> and the latter returns `nil' for a "text-only terminal".  But in
> this user's case they apparently don't agree about his "terminal".
> Is there some nuance here - a difference between a "character-only"
> terminal and a "text-only" terminal?

The only way I can explain how the above contradiction happens is that
those 2 functions are called for different frames.  On Unix an Emacs
session can have both text-mode and GUI frames, and in that case it is
very important to invoke each of those 2 functions with the correct
frame, especially if pop-up frames are involved.

> Just what are the relations between `emacs -nw', `framep'
> returning `t', and `display-graphic-p' returning `nil'?

"emacs -nw" doesn't directly determine the value returned by those
functions.  What matters is the type of frame which is the argument of
these functions (by default, the selected frame at the time of the
call).  "emacs -nw" starts with a single text-mode frame, but on Unix
it can create GUI frames on various X displays, and on those GUI
frames display-graphic-p will return non-nil.

> What should I be testing for here, to detect a "terminal" or
> a "terminal" mode (I'm not sure just what the problematic use
> case is), so that it then makes sense to check the option value?

As should be apparent from the above, you logic is flawed to begin
with, because a single Emacs session can have both text-mode and GUI
frames.  So I think you should examine the value of display-graphic-p
not at key-binding time, but inside diredp-chown-this-file, because
only then you know on which kind of frame will the command run.



reply via email to

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