From: Eli Zaretskii <eliz@gnu.org>
To: Drew Adams <drew.adams@oracle.com>
Cc: emacs-devel@gnu.org
Subject: Re: `emacs -nw', `framep' returning `t', `display-graphic-p' returning `nil'
Date: Sun, 17 Dec 2017 19:34:39 +0200 [thread overview]
Message-ID: <836095qmvk.fsf@gnu.org> (raw)
In-Reply-To: <a508c72a-05ba-4b83-a687-5e7b4134821f@default> (message from Drew Adams on Sun, 17 Dec 2017 09:10:00 -0800 (PST))
> Date: Sun, 17 Dec 2017 09:10:00 -0800 (PST)
> From: Drew Adams <drew.adams@oracle.com>
>
> 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.
next prev parent reply other threads:[~2017-12-17 17:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-17 17:10 `emacs -nw', `framep' returning `t', `display-graphic-p' returning `nil' Drew Adams
2017-12-17 17:34 ` Eli Zaretskii [this message]
2017-12-17 18:02 ` Achim Gratz
2017-12-17 20:10 ` Eli Zaretskii
2017-12-17 21:06 ` Achim Gratz
[not found] <<a508c72a-05ba-4b83-a687-5e7b4134821f@default>
[not found] ` <<836095qmvk.fsf@gnu.org>
2017-12-17 22:26 ` Drew Adams
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=836095qmvk.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.