From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.bugs Subject: bug#35230: char-displayable-p return code is conflictingly documented Date: Sun, 14 Apr 2019 11:51:36 +0200 Message-ID: References: <837ebzmlnf.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="190812"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 35230@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Apr 14 11:57:50 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 1hFbtV-000nTz-HV for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Apr 2019 11:57:49 +0200 Original-Received: from localhost ([127.0.0.1]:33533 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFbtU-0001fP-Gh for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Apr 2019 05:57:48 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:36090) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hFbtN-0001er-60 for bug-gnu-emacs@gnu.org; Sun, 14 Apr 2019 05:57:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hFbnv-0007Bj-Gj for bug-gnu-emacs@gnu.org; Sun, 14 Apr 2019 05:52:05 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46313) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hFbnu-0007BQ-97 for bug-gnu-emacs@gnu.org; Sun, 14 Apr 2019 05:52:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hFbnu-0002YI-4i for bug-gnu-emacs@gnu.org; Sun, 14 Apr 2019 05:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 14 Apr 2019 09:52: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.15552355079790 (code B ref 35230); Sun, 14 Apr 2019 09:52:02 +0000 Original-Received: (at 35230) by debbugs.gnu.org; 14 Apr 2019 09:51:47 +0000 Original-Received: from localhost ([127.0.0.1]:59857 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hFbnf-0002Xp-36 for submit@debbugs.gnu.org; Sun, 14 Apr 2019 05:51:47 -0400 Original-Received: from mail-wr1-f44.google.com ([209.85.221.44]:34896) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hFbnd-0002Xd-55 for 35230@debbugs.gnu.org; Sun, 14 Apr 2019 05:51:45 -0400 Original-Received: by mail-wr1-f44.google.com with SMTP id w1so17772695wrp.2 for <35230@debbugs.gnu.org>; Sun, 14 Apr 2019 02:51:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:mail-copies-to:gmane-reply-to-list :date:in-reply-to:message-id:mime-version:content-transfer-encoding; bh=mcuKLYvYPcCjBYPoxievea284f0GkyMWwntjKPAGdBc=; b=ZMuJXWz9Ji5Q5FFBJ+So6WIlyUA15n+JZeJ9lSQumFekoYkgfFrFtirQI5D1ZtgLP0 U2Te01+rmiWRBRCQBrJAuWeH9Lygd8DatQBBvsnXr2z+IQvfsJRr99CoEinXmFX7JTca 4A/XUJmiFa9d0HwsgKuc3YKcQbN4b4K/l6h4ZWl0R3fJ2eOFwPTrJb1tB6ipADg4cs19 DgxR/RDP4f7MLCRJyHFpf6n0El+O9KG0DxEl4rWVbz1UB6g/osmdhGJq5Ldhn5dpUxza xI3mgvpJGAikTifN3Uz8aY5p89GPDymW07jR3CLGqqYhd7+r2XGByEu7DhP7xGQGjDu5 46RQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:mail-copies-to :gmane-reply-to-list:date:in-reply-to:message-id:mime-version :content-transfer-encoding; bh=mcuKLYvYPcCjBYPoxievea284f0GkyMWwntjKPAGdBc=; b=NpFT3P3fH00MeJmWEJCN0GbYdmRjVckhgNs/9Lg155USosucXygwHl0Pwphv4gYToI aDxHlkAPnHsmngOUg+81Wmdo89preYDWKseOmhH1+/n3DvcouYGKEoeM7O2BknjUZTqM cs9+WrJ+D8wJzQoUcCmEKE2in05GagNWZWkTS+ugv5pwUT2gAiIRSfao3wLLyf+7trky UynKlgG+ogYRlAv9VwXu1SCAgph9OGrKlnvvJkKrUrmZI5zO9MM6/EWadaCP+osl38aI eD5kNmIS5JWk+Xtnv2atprfd1oTY2Qq4XGDvVsWJ3GG1tSp2WLz8sm3MdhODe/tYAYiD 7org== X-Gm-Message-State: APjAAAWASXJgMu44v1eiKNV6rv2zUIxFlTA1fZ2hcVj/I3WcwV5OV/bQ 1jE9TPDSvQ40y2Dm84eYCPXeKZGR X-Google-Smtp-Source: APXvYqxXK8gGiC0hA4qqOJAUjoxUFFlV2NpY17bTn7BP30Hc05+oYscScjyor+qgaLjQceHUEICAUg== X-Received: by 2002:adf:b3d4:: with SMTP id x20mr42400496wrd.284.1555235498835; Sun, 14 Apr 2019 02:51:38 -0700 (PDT) Original-Received: from rpluim-mac ([2a01:e34:ecfc:a860:8d50:d54a:3ca:4894]) by smtp.gmail.com with ESMTPSA id q17sm38032600wrw.70.2019.04.14.02.51.36 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Sun, 14 Apr 2019 02:51:37 -0700 (PDT) Mail-Copies-To: never Gmane-Reply-To-List: yes In-Reply-To: <837ebzmlnf.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 12 Apr 2019 15:51:48 +0300") 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:157617 Archived-At: >>>>> On Fri, 12 Apr 2019 15:51:48 +0300, Eli Zaretskii said: >> From: Robert Pluim Date: Thu, 11 Apr 2019 >> 16:49:29 +0200 >>=20 >> (This comes as a result of the stackexchange question at >> https://emacs.stackexchange.com/questions/48810) >>=20 >> char-displayable-p docstring says >>=20 >> Return non-nil if we should be able to display CHAR. >>=20 >> The elisp manual says something subtly different: >>=20 >> This function returns =E2=80=98t=E2=80=99 if Emacs ought to be able = to display >> CHAR. More precisely, if the selected frame=E2=80=99s fontset has a >> font to display the character set that CHAR belongs to. >>=20 >> The function itself is more in line with the docstring: Eli> Yes, the manual is wrong and should be fixed. Non-nil is Eli> exactly right, and callers should not depend on any finer Eli> definition of the return value, as it could be many different Eli> non-nil objects. That I can do easily enough in emacs-26 >> (char-displayable-p #xE01EF) =3D> unicode >>=20 >> since I don=CA=BCt 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 >>=20 >> ;; On a text terminal without glyph codes, CHAR is displayable >> ;; if the coding system for the terminal can encode it. >>=20 >> but I=CA=BCm very much on a graphical terminal here, not a text >> terminal. Eli> This is a (known) deficiency in char-displayable-p, but one Eli> which is not easy to fix: no one says that every call to this Eli> function asks about the selected frame, so we cannot Eli> unconditionally disable the TTY branch when on GUI frames. Eli> Perhaps an optional argument could be added for that purpose, Eli> which is the frame for which to make the test. At least Eli> some, if not most, of the calls will still need to omit that Eli> argument, though, because we currently need to know that up Eli> front to set up the quote-style, for example. Eli> Perhaps mentioning this caveat in the manual would be good. I=CA=BCve made an attempt below. Do we want a cross reference to 'Glyphless Chars' as well? diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index b07999432c..fac883ae16 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi @@ -3507,12 +3507,16 @@ Fontsets @end defun =20 @defun char-displayable-p char -This function returns @code{t} if Emacs ought to be able to display -@var{char}. More precisely, if the selected frame's fontset has a -font to display the character set that @var{char} belongs to. +This function returns non-@code{nil} if Emacs ought to be able to +display @var{char}. More precisely, if the selected frame's fontset +has a font to display the character set that @var{char} belongs to. =20 Fontsets can specify a font on a per-character basis; when the fontset does that, this function's value may not be accurate. + +This function may return non-@code{nil} even when there is no font +available, since it also checks if the coding system for the text +terminal can encode the character. @end defun =20 @node Low-Level Font