From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#35230: char-displayable-p return code is conflictingly documented Date: Fri, 12 Apr 2019 15:51:48 +0300 Message-ID: <837ebzmlnf.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="183341"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 35230@debbugs.gnu.org To: Robert Pluim Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Apr 12 14:53:58 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hEvgr-000lYC-Oo for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Apr 2019 14:53:57 +0200 Original-Received: from localhost ([127.0.0.1]:36112 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hEvgq-00042w-MM for geb-bug-gnu-emacs@m.gmane.org; Fri, 12 Apr 2019 08:53:56 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:46803) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hEvg4-0003Uo-Ee for bug-gnu-emacs@gnu.org; Fri, 12 Apr 2019 08:53:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hEvfy-0005tZ-Fb for bug-gnu-emacs@gnu.org; Fri, 12 Apr 2019 08:53:08 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42047) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hEvfy-0005tU-8J for bug-gnu-emacs@gnu.org; Fri, 12 Apr 2019 08:53:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hEvfy-0002jD-4l for bug-gnu-emacs@gnu.org; Fri, 12 Apr 2019 08:53:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 12 Apr 2019 12:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35230 X-GNU-PR-Package: emacs Original-Received: via spool by 35230-submit@debbugs.gnu.org id=B35230.155507353310426 (code B ref 35230); Fri, 12 Apr 2019 12:53:02 +0000 Original-Received: (at 35230) by debbugs.gnu.org; 12 Apr 2019 12:52:13 +0000 Original-Received: from localhost ([127.0.0.1]:55591 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hEvfB-0002i5-04 for submit@debbugs.gnu.org; Fri, 12 Apr 2019 08:52:13 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:60272) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hEvf9-0002hr-KS for 35230@debbugs.gnu.org; Fri, 12 Apr 2019 08:52:12 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:59581) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hEvf4-0005ST-CI; Fri, 12 Apr 2019 08:52:06 -0400 Original-Received: from [176.228.60.248] (port=3355 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hEvf3-0004Mo-5p; Fri, 12 Apr 2019 08:52:05 -0400 In-reply-to: (message from Robert Pluim on Thu, 11 Apr 2019 16:49:29 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:157550 Archived-At: > From: Robert Pluim > Date: Thu, 11 Apr 2019 16:49:29 +0200 > > (This comes as a result of the stackexchange question at > https://emacs.stackexchange.com/questions/48810) > > char-displayable-p docstring says > > Return non-nil if we should be able to display CHAR. > > The elisp manual says something subtly different: > > This function returns ‘t’ if Emacs ought to be able to display > CHAR. More precisely, if the selected frame’s fontset has a font > to display the character set that CHAR belongs to. > > The function itself is more in line with the docstring: Yes, the manual is wrong and should be fixed. Non-nil is exactly right, and callers should not depend on any finer definition of the return value, as it could be many different non-nil objects. > (char-displayable-p #xE01EF) => unicode > > since I donʼt have a font with a glyph for that character, so it ends > up displayed as a box with the unicode code point inside it. The code > that results in 'unicode has the comment > > ;; On a text terminal without glyph codes, CHAR is displayable > ;; if the coding system for the terminal can encode it. > > but Iʼm very much on a graphical terminal here, not a text terminal. This is a (known) deficiency in char-displayable-p, but one which is not easy to fix: no one says that every call to this function asks about the selected frame, so we cannot unconditionally disable the TTY branch when on GUI frames. Perhaps an optional argument could be added for that purpose, which is the frame for which to make the test. At least some, if not most, of the calls will still need to omit that argument, though, because we currently need to know that up front to set up the quote-style, for example. Perhaps mentioning this caveat in the manual would be good. Thanks.