From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: `emacs -nw', `framep' returning `t', `display-graphic-p' returning `nil' Date: Sun, 17 Dec 2017 09:10:00 -0800 (PST) Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1513530526 27860 195.159.176.226 (17 Dec 2017 17:08:46 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 17 Dec 2017 17:08:46 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Dec 17 18:08:42 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eQcQa-0006sj-5t for ged-emacs-devel@m.gmane.org; Sun, 17 Dec 2017 18:08:40 +0100 Original-Received: from localhost ([::1]:54968 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQcSY-0005kq-EL for ged-emacs-devel@m.gmane.org; Sun, 17 Dec 2017 12:10:42 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49840) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eQcS0-0005Ui-Jy for emacs-devel@gnu.org; Sun, 17 Dec 2017 12:10:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eQcRx-0001rs-B2 for emacs-devel@gnu.org; Sun, 17 Dec 2017 12:10:08 -0500 Original-Received: from aserp2120.oracle.com ([141.146.126.78]:51088) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eQcRx-0001rL-1b for emacs-devel@gnu.org; Sun, 17 Dec 2017 12:10:05 -0500 Original-Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.21/8.16.0.21) with SMTP id vBHH6USM028949 for ; Sun, 17 Dec 2017 17:10:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=mime-version : message-id : date : from : sender : to : subject : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=aF3TA+Hb1NBGZqw4ccBEGlx8k3QUgGjay+Qp5W1u4Hw=; b=HHweZLP37959osFtafuP60OC/DUCoBGmdRK/AhILVduQC8bGLAbHLWE7VeVh3KbOMWs3 BGFErzLTHnTAqF4Zfa7QTXB7ynabbihL0saO5wcOmrNZn/BwNVogzVL/z+yBwvfTwjnp 1Lf3dYJqOvWA4Vwh8Es++DVRWqTC2+RapTky86DuijY0FN1wJONoDewd/XgBMd0NhwLS KDQ0EpnLA/46s2r8tK/6IhqvaW8UY0AKoAKUCMY9pNsQjVTuFCmQD//dQeiBp5bSPSgW Jd7usfp1j/CK1z8BBB2AXn6ZHfBc2sNSuser9KTwNoDnC+oArP/MvY30KMujJCncUEo5 WQ== Original-Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2120.oracle.com with ESMTP id 2ewvh9g0tq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 17 Dec 2017 17:10:02 +0000 Original-Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id vBHHA1NK017804 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Sun, 17 Dec 2017 17:10:01 GMT Original-Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id vBHHA10v007235 for ; Sun, 17 Dec 2017 17:10:01 GMT X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 16.0.4627.0 (x86)] X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8748 signatures=668649 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1712170234 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 141.146.126.78 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:221175 Archived-At: I guess I don't really understand "terminal mode" and the use of Emacs with a character-only display. (The last time I used Emacs regularly without a graphic display was before Emacs had any support for graphic display!) See https://emacs.stackexchange.com/a/37371/105 and the question it answers. The problem exposed there is that, by default, library dired+.el binds key `M-S-o' (aka `M-O'). Apparently, when Emacs is used with some terminals, or in some terminal mode(s)?, that key sequence is sent by the arrow keys. (On MS Windows, I don't see the problem using `emacs -nw', but I don't claim that's the case for all users.) (A similar problem arose for `M-S-b', `C-M-S-b', `C-M-S-r', `C-M-S-g', `C-M-S-m', and `C-M-S-t': they might not be handled well in some "terminal" contexts.) To help with the problem, I did this: 1. Added a Boolean user option, ` diredp-bind-problematic-terminal-keys' (t by default). 2. Prevented binding the key when the display is character-only AND the option is nil: (when (or (display-graphic-p) diredp-bind-problematic-terminal-keys) (define-key dired-mode-map [(meta shift ?o)] 'diredp-chown-this-file)) That apparently solved the problem for at least some users: setting the option to nil prevented the key binding. I was thinking that when `display-graphic-p' is non-nil the problem wouldn't exist. But apparently at least one user has the problem even though `display-graphic-p' returns non-nil. I use `display-graphic-p' here and there in my code, and I wonder now if it is really doing what I have thought. (I used `window-sytem' before `display-graphic-p' existed.) 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? Just what are the relations between `emacs -nw', `framep' returning `t', and `display-graphic-p' returning `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? (Yes, I could always check just the option. Still, I'll like to understand this a bit better. Is there a good test to use here, which would show that the user's session can handle such a key, in which case there is no need to test the option?)