GNU bug report logs - #57693
29.0.50; Is there a more reliable version of `char-displayable-p'?

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Ihor Radchenko <yantar92@HIDDEN>; dated Fri, 9 Sep 2022 13:25:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 19 Feb 2023 12:23:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 19 07:23:34 2023
Received: from localhost ([127.0.0.1]:45908 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pTij8-0002QR-8R
	for submit <at> debbugs.gnu.org; Sun, 19 Feb 2023 07:23:34 -0500
Received: from eggs.gnu.org ([209.51.188.92]:39262)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pTij5-0002QC-7p
 for 57693 <at> debbugs.gnu.org; Sun, 19 Feb 2023 07:23:32 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pTiiy-0002QG-Um; Sun, 19 Feb 2023 07:23:26 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=bxtjPIF1sY+eBTegF4Td8geVfhxvMbLS3PrFkiNaDyc=; b=r0mo7/Dgqdh9agT7C4z0
 Dt/kd17p5POJvz8MaBxuB8xHLnN5/VP9/Pd3LKP3EEZg1XxUDZsFnVIthoJgmW3WlFNWvW7zjAlXL
 Lvm/WYw0F3UdMoKngMEGubrxpD2MAujkMkx5cdcoxMI1HlHbrLGYvYY98jlxCvW8yoL2qz+X/J6DT
 4GMDOP0ZucZMidKEypJQZ+io/ZQIF+9YEILgF5R5oN5QRgtO1uoeISE+bWItSv7xTB95gklOFZP8P
 nyAFOaGdCBE7hFttzNFsJ2hsEhHLPgRTMlqzpBt04K45uG5JKhNxrYPQ1HTah7Vw6eNvXa2hdVCOo
 VEPPuk9FF/ONgg==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pTiix-0007XE-A4; Sun, 19 Feb 2023 07:23:24 -0500
Date: Sun, 19 Feb 2023 14:23:28 +0200
Message-Id: <83ttzhx2rj.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
In-Reply-To: <877cwdkgbz.fsf@localhost> (message from Ihor Radchenko on Sun,
 19 Feb 2023 12:08:48 +0000)
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
References: <87v8pw1xyo.fsf@localhost> <878rmr25tk.fsf@localhost>
 <83czc3bvbg.fsf@HIDDEN> <87y1urybt6.fsf@localhost>
 <837d2bbr2s.fsf@HIDDEN> <87edwjy77h.fsf@localhost>
 <831qsjboy0.fsf@HIDDEN> <87v8puw945.fsf@localhost>
 <838rmq9rfr.fsf@HIDDEN> <837d2a9qcu.fsf@HIDDEN>
 <875yhtw3ed.fsf@localhost>
 <CADwFkmmEDXzTt18aNAfib1+Cm+Uzia83O6Bd6OnT-nxA9B7o3g@HIDDEN>
 <831qmo146g.fsf@HIDDEN>
 <CADwFkm=Ju0k+6oA82v7TOaDFajqchgbWjJoTavdSJ4nHo3DUbw@HIDDEN>
 <83wn4fzcl5.fsf@HIDDEN>
 <CADwFkm=veDinWeM8CGPOGjVAnekUPRs+pXyjCMEV5za2s5eYiQ@HIDDEN>
 <83lekvz605.fsf@HIDDEN> <871qmnky3b.fsf@localhost>
 <83cz67yyon.fsf@HIDDEN> <87edqlki2b.fsf@localhost>
 <83zg99x42y.fsf@HIDDEN> <877cwdkgbz.fsf@localhost>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org, stefankangas@HIDDEN, yantar92@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Ihor Radchenko <yantar92@HIDDEN>
> Cc: stefankangas@HIDDEN, yantar92@HIDDEN, 57693 <at> debbugs.gnu.org
> Date: Sun, 19 Feb 2023 12:08:48 +0000
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> >> or within text-properties
> >
> > Only if really needed.  Adding a text property for this will
> > complicate the display code which handles this, so I'd rather we
> > didn't unless we have a _very_ good reason.  And I don't see such a
> > reason, since we are talking about characters that cannot be displayed
> > by any available font, something that is unlikely to be limited to
> > just a small region of text.
> 
> The replacement may only make sense in particular context. For example,
> mode line indicator for newlines can be ?: or ?\ or ?/. If we want to
> display a more intuitive Unicode char like ?⏎ or ?β€Έ, it does not make
> sense to replace all the ?⏎ in buffer with ?:.

We could have a special glyphless-char-display table for mode-line and
header-line.  Buffer-local values don't apply well to those anyway,
because they display strings, not buffer text.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 19 Feb 2023 12:08:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 19 07:08:18 2023
Received: from localhost ([127.0.0.1]:45889 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pTiUL-00020C-ND
	for submit <at> debbugs.gnu.org; Sun, 19 Feb 2023 07:08:18 -0500
Received: from mout01.posteo.de ([185.67.36.65]:33557)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1pTiUK-0001zz-3A
 for 57693 <at> debbugs.gnu.org; Sun, 19 Feb 2023 07:08:16 -0500
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 490652400D5
 for <57693 <at> debbugs.gnu.org>; Sun, 19 Feb 2023 13:08:10 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1676808490; bh=rUp7cAbCSLwKow1XmIfL9MBTu7FLaXHczs0mJwLOIv8=;
 h=From:To:Cc:Subject:Date:From;
 b=XEjhNgGrs9BLifYxcE8quxK3Aor2EUHI3owgHjK6/fw+eWkHWpbpPCSTUuBnl2I7S
 MmY4mqYRm/jXDNR4EgTbnlyAHWthRmHsZB1HHZodf8ITbjttTYcNaIBtkp8k6t8QH3
 r/zZHStLnHnHma6uncgeUz++8aTOuaatxktp7ahke2bMiJccW0G6K5lLATZ61JuG21
 e61nCHhJDA8jZx9S0gF9JAey91VKdHd9wMWSGgk4W0j6v7dv4JfSeEH4w1m2nnfYJg
 rm0zjG/Y70o60EOxSoWzC6F3VaMv8NALbboMXlPnGpWW9rozBaN9kkTmm9BBsuRISH
 XBCBpYXOSkOBQ==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4PKPT52vFLz9rxG;
 Sun, 19 Feb 2023 13:08:09 +0100 (CET)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
In-Reply-To: <83zg99x42y.fsf@HIDDEN>
References: <87v8pw1xyo.fsf@localhost> <878rmr25tk.fsf@localhost>
 <83czc3bvbg.fsf@HIDDEN> <87y1urybt6.fsf@localhost>
 <837d2bbr2s.fsf@HIDDEN> <87edwjy77h.fsf@localhost>
 <831qsjboy0.fsf@HIDDEN> <87v8puw945.fsf@localhost>
 <838rmq9rfr.fsf@HIDDEN> <837d2a9qcu.fsf@HIDDEN>
 <875yhtw3ed.fsf@localhost>
 <CADwFkmmEDXzTt18aNAfib1+Cm+Uzia83O6Bd6OnT-nxA9B7o3g@HIDDEN>
 <831qmo146g.fsf@HIDDEN>
 <CADwFkm=Ju0k+6oA82v7TOaDFajqchgbWjJoTavdSJ4nHo3DUbw@HIDDEN>
 <83wn4fzcl5.fsf@HIDDEN>
 <CADwFkm=veDinWeM8CGPOGjVAnekUPRs+pXyjCMEV5za2s5eYiQ@HIDDEN>
 <83lekvz605.fsf@HIDDEN> <871qmnky3b.fsf@localhost>
 <83cz67yyon.fsf@HIDDEN> <87edqlki2b.fsf@localhost>
 <83zg99x42y.fsf@HIDDEN>
Date: Sun, 19 Feb 2023 12:08:48 +0000
Message-ID: <877cwdkgbz.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org, stefankangas@HIDDEN, yantar92@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

>> or within text-properties
>
> Only if really needed.  Adding a text property for this will
> complicate the display code which handles this, so I'd rather we
> didn't unless we have a _very_ good reason.  And I don't see such a
> reason, since we are talking about characters that cannot be displayed
> by any available font, something that is unlikely to be limited to
> just a small region of text.

The replacement may only make sense in particular context. For example,
mode line indicator for newlines can be ?: or ?\ or ?/. If we want to
display a more intuitive Unicode char like ?=E2=8F=8E or ?=E2=80=B8, it doe=
s not make
sense to replace all the ?=E2=8F=8E in buffer with ?:.

Of course, even just having (2) will be an improvement.

>> 2. Making (set-char-table-range glyphless-char-display ?A ?B) work on
>>    GUI as well, not just in terminals
>
> You mean (set-char-table-range glyphless-char-display ?A "B"), I
> presume (the value cannot be a character, only a string).

Yes.

>> 3. Making the rules recursive.
>
> What for?  It's a very significant complication, and I cannot see the
> purpose.  The string value _must_ use only ASCII characters, precisely
> _because_ we want to be sure no recursion will be needed.

Makes sense. I was thinking about multiple alternatives from more fancy
to less fancy down to fallback ASCII. This feature is of minor
importance.

BTW, if we need the replacement of character sequences, is
`composition-function-table' supposed to be used? It is not
well-described in the manual and I only know it from
https://www.masteringemacs.org/article/unicode-ligatures-color-emoji

--=20
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 19 Feb 2023 11:55:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 19 06:55:06 2023
Received: from localhost ([127.0.0.1]:45855 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pTiHa-0001Z1-FO
	for submit <at> debbugs.gnu.org; Sun, 19 Feb 2023 06:55:06 -0500
Received: from eggs.gnu.org ([209.51.188.92]:54812)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pTiHY-0001YR-MP
 for 57693 <at> debbugs.gnu.org; Sun, 19 Feb 2023 06:55:05 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pTiHS-0003VQ-Mu; Sun, 19 Feb 2023 06:54:58 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=G0pu1eg0yM8B1qRUEQivXdAiDydhYXHU3/yeGLF1fDc=; b=Bh5oNa2A8iil
 O4XIA9puUNn+CxZsj7rGNCgtPuCsMT4Xx73f9bdsaiGQC5aJBUOsrh1oP5rAyX8y2R1ZvQoHxazso
 0mkgxRgWliiMhRKo8MJ4vwFwxiz5ZWp1crFxLT+wp5B2IGY//Eh12g1ExtF8P+jIeGtEmIbycxV7s
 JvZut69KuChso3RzRTpOZc1uS5Avahg+FYFwNKXMIKYZAz1Vi617vyERjUIKYOvyvHK507S5B0MQj
 h+HHdd3+KJtaxMP6cSoI1sXmKOMCN935Jop8yNIYws3TH9ofIrzbNmydvikmgc3SfgtmhCWlKPvTI
 0ERsloP9I17B02a8ljbjQw==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pTiHR-0000G3-8P; Sun, 19 Feb 2023 06:54:58 -0500
Date: Sun, 19 Feb 2023 13:55:01 +0200
Message-Id: <83zg99x42y.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
In-Reply-To: <87edqlki2b.fsf@localhost> (message from Ihor Radchenko on Sun,
 19 Feb 2023 11:31:24 +0000)
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@HIDDEN>
 <87y1urybt6.fsf@localhost> <837d2bbr2s.fsf@HIDDEN>
 <87edwjy77h.fsf@localhost> <831qsjboy0.fsf@HIDDEN>
 <87v8puw945.fsf@localhost> <838rmq9rfr.fsf@HIDDEN>
 <837d2a9qcu.fsf@HIDDEN> <875yhtw3ed.fsf@localhost>
 <CADwFkmmEDXzTt18aNAfib1+Cm+Uzia83O6Bd6OnT-nxA9B7o3g@HIDDEN>
 <831qmo146g.fsf@HIDDEN>
 <CADwFkm=Ju0k+6oA82v7TOaDFajqchgbWjJoTavdSJ4nHo3DUbw@HIDDEN>
 <83wn4fzcl5.fsf@HIDDEN>
 <CADwFkm=veDinWeM8CGPOGjVAnekUPRs+pXyjCMEV5za2s5eYiQ@HIDDEN>
 <83lekvz605.fsf@HIDDEN> <871qmnky3b.fsf@localhost>
 <83cz67yyon.fsf@HIDDEN> <87edqlki2b.fsf@localhost>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org, stefankangas@HIDDEN, yantar92@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Ihor Radchenko <yantar92@HIDDEN>
> Cc: stefankangas@HIDDEN, yantar92@HIDDEN, 57693 <at> debbugs.gnu.org
> Date: Sun, 19 Feb 2023 11:31:24 +0000
> 
> 1. Allowing the char-table to be buffer-local

Trivial (should be possible right now)

> or within text-properties

Only if really needed.  Adding a text property for this will
complicate the display code which handles this, so I'd rather we
didn't unless we have a _very_ good reason.  And I don't see such a
reason, since we are talking about characters that cannot be displayed
by any available font, something that is unlikely to be limited to
just a small region of text.

> 2. Making (set-char-table-range glyphless-char-display ?A ?B) work on
>    GUI as well, not just in terminals

You mean (set-char-table-range glyphless-char-display ?A "B"), I
presume (the value cannot be a character, only a string).

> 3. Making the rules recursive.

What for?  It's a very significant complication, and I cannot see the
purpose.  The string value _must_ use only ASCII characters, precisely
_because_ we want to be sure no recursion will be needed.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 19 Feb 2023 11:30:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 19 06:30:57 2023
Received: from localhost ([127.0.0.1]:45839 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pThuD-0000uF-D0
	for submit <at> debbugs.gnu.org; Sun, 19 Feb 2023 06:30:57 -0500
Received: from mout01.posteo.de ([185.67.36.65]:49131)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1pThuB-0000ty-6G
 for 57693 <at> debbugs.gnu.org; Sun, 19 Feb 2023 06:30:55 -0500
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 2F9AC2400D2
 for <57693 <at> debbugs.gnu.org>; Sun, 19 Feb 2023 12:30:46 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1676806249; bh=xTOMYXtAtVVs4SxrEKZbbgLIX8Tj15SoNjDuTOtx1y0=;
 h=From:To:Cc:Subject:Date:From;
 b=avp2x4bNxqvkDe6K/8Y5aSUvcp91OEyGooJko56TG6hpW1CRQDk1xytrNwaWkquyg
 uHFm8tZ6LHx9ODxdRFk/Y6g/iq7iWup85I649KRVDaCRuY+SQasWGFzOLJs4OIYq+2
 P3wshI04T6SIKH7Er0D/48VWenMXCp1EqA9Ybhy93LbBvZ4IPxS8eVsAXZdCybKQ3c
 1hL8XsYyoqlnKQRvsfTZRpO5rm6mrfMULjGijdPM18WwLokoZYpw5WZXLH4tL6VJEK
 CIT/M1864sKUX3nsgrQTJA7o7p4IN1h+lk4kHeVjcskQE7OjHQj/vUh+zYZSAMlcHv
 /XiEP3QoxT1sQ==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4PKNdx6g15z6tn5;
 Sun, 19 Feb 2023 12:30:44 +0100 (CET)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
In-Reply-To: <83cz67yyon.fsf@HIDDEN>
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@HIDDEN>
 <87y1urybt6.fsf@localhost> <837d2bbr2s.fsf@HIDDEN>
 <87edwjy77h.fsf@localhost> <831qsjboy0.fsf@HIDDEN>
 <87v8puw945.fsf@localhost> <838rmq9rfr.fsf@HIDDEN>
 <837d2a9qcu.fsf@HIDDEN> <875yhtw3ed.fsf@localhost>
 <CADwFkmmEDXzTt18aNAfib1+Cm+Uzia83O6Bd6OnT-nxA9B7o3g@HIDDEN>
 <831qmo146g.fsf@HIDDEN>
 <CADwFkm=Ju0k+6oA82v7TOaDFajqchgbWjJoTavdSJ4nHo3DUbw@HIDDEN>
 <83wn4fzcl5.fsf@HIDDEN>
 <CADwFkm=veDinWeM8CGPOGjVAnekUPRs+pXyjCMEV5za2s5eYiQ@HIDDEN>
 <83lekvz605.fsf@HIDDEN> <871qmnky3b.fsf@localhost>
 <83cz67yyon.fsf@HIDDEN>
Date: Sun, 19 Feb 2023 11:31:24 +0000
Message-ID: <87edqlki2b.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org, stefankangas@HIDDEN, yantar92@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

> We already have something like that: see glyphless-char-display and
> glyphless-char-display-mode.

Thanks for the pointer! This sounds like a suitable approach when
displaying "fancy" characters.

> The problem is that (a) on GUI displays
> the replacement will be displayed in a box; (b) the replacement must
> be an ASCII character; and (c) the char-table we use for that is
> global, i.e. it affects the entire session.  But if someone wants a
> more flexible feature which lifts some of those restrictions, that's
> the place to start nonetheless.

What about

1. Allowing the char-table to be buffer-local or within text-properties
2. Making (set-char-table-range glyphless-char-display ?A ?B) work on
   GUI as well, not just in terminals
3. Making the rules recursive.
   So that setting something like
   (set-char-table-range glyphless-char-display ?A "1")
   (set-char-table-range glyphless-char-display ?1 "2")
   will display "A" as "2" (A->1->2)

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 18 Feb 2023 12:00:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 18 07:00:48 2023
Received: from localhost ([127.0.0.1]:42712 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pTLtY-0001lW-D2
	for submit <at> debbugs.gnu.org; Sat, 18 Feb 2023 07:00:48 -0500
Received: from eggs.gnu.org ([209.51.188.92]:43234)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pTLtW-0001lK-39
 for 57693 <at> debbugs.gnu.org; Sat, 18 Feb 2023 07:00:46 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pTLtO-0006dp-IF; Sat, 18 Feb 2023 07:00:40 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=7WAUIFAO3Z5m2CuDu5RYSBeGQTfwpfaSTu4BRLFf9TU=; b=EhRxkXiYHS77
 lOHjZoCB8uof2UhRN8wN/E05J1sqQ/NMPqt+XIKORNoinvYIEHNAx238LBQbz6OT7eYr28vbb+pR3
 Zxn+GTRQVcV4Nt6+xsnHA295q08UayltMJt5WsyJWb50R+iUh+Tjw3bCs5ZzbT9QXh2RUyrBbd6pg
 +8VTQIpUc9MLE3sAaXBGqraYkEaLC1x+QFcEoTFDOJPt6PyWVDaF0mX1nV2scqERlq2Mpeux6KuA+
 4wYBplIJNND5lEcbvkAJSpKSUWkcCpGRh+5mi8ahlsoB4q0cuaNKq0ISkvhZHpyh+Dr8jsJIgP9/I
 NuSrr8qZYPVjia0N/gYsgQ==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pTLt6-0003tx-S8; Sat, 18 Feb 2023 07:00:33 -0500
Date: Sat, 18 Feb 2023 14:00:19 +0200
Message-Id: <83bklryyi4.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
In-Reply-To: <87y1ovjjei.fsf@localhost> (message from Ihor Radchenko on Sat,
 18 Feb 2023 11:35:33 +0000)
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@HIDDEN>
 <87y1urybt6.fsf@localhost> <837d2bbr2s.fsf@HIDDEN>
 <87edwjy77h.fsf@localhost> <831qsjboy0.fsf@HIDDEN>
 <87v8puw945.fsf@localhost> <838rmq9rfr.fsf@HIDDEN>
 <837d2a9qcu.fsf@HIDDEN> <875yhtw3ed.fsf@localhost>
 <CADwFkmmEDXzTt18aNAfib1+Cm+Uzia83O6Bd6OnT-nxA9B7o3g@HIDDEN>
 <831qmo146g.fsf@HIDDEN>
 <CADwFkm=Ju0k+6oA82v7TOaDFajqchgbWjJoTavdSJ4nHo3DUbw@HIDDEN>
 <83wn4fzcl5.fsf@HIDDEN> <87y1ovjjei.fsf@localhost>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org, stefankangas@HIDDEN, yantar92@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Ihor Radchenko <yantar92@HIDDEN>
> Cc: Stefan Kangas <stefankangas@HIDDEN>, yantar92@HIDDEN,
>  57693 <at> debbugs.gnu.org
> Date: Sat, 18 Feb 2023 11:35:33 +0000
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> > If you need to care for TTY frames, that problem has no known solution
> > that works for all terminal emulators.  So using fancy characters in
> > general-purpose Emacs features is a problem that cannot be solved
> > programmatically, or at least we don't currently know how to do that.
> 
> I am not sure if it is relevant, but I see
> https://unix.stackexchange.com/questions/184345/detect-how-much-of-unicode-my-terminal-supports-even-through-screen
> 
> May it be something of use for Emacs?

If you are asking about the Linux console, then we already have a way
of asking it whether it supports a given character.

If you are asking about the kludges they suggest for other terminals,
where we are supposed to deduce support fro a character by counting
columns, then that is both unreliable and extremely cumbersome (we'd
need to try to actually display a character in order to know whether
its displayable).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 18 Feb 2023 11:56:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 18 06:56:31 2023
Received: from localhost ([127.0.0.1]:42707 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pTLpO-0001dF-OF
	for submit <at> debbugs.gnu.org; Sat, 18 Feb 2023 06:56:31 -0500
Received: from eggs.gnu.org ([209.51.188.92]:48336)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pTLpM-0001cy-MS
 for 57693 <at> debbugs.gnu.org; Sat, 18 Feb 2023 06:56:29 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pTLpH-0005kf-2r; Sat, 18 Feb 2023 06:56:23 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=fzbNZtiEEUQj/r9hB6SEOMecB72Y3TFn7C/0S64Bsc0=; b=HXV8Dmva41s54qTD53IK
 Q3TLs/4bvyFvOJkma8Fwq+qWk/33CGfxDPki31l9v1jsrYWGRn+6C/acIgTZUidGZVwsmOy9atmcE
 W5wxI6eMF+CR31EBf2YivIeBszKifHBMBAX0e4GMqRWGMhm4Jiy4sDPCPajY0FqVqjrZw1tSu+Sza
 +t2Wra2iwdnvUj2NNuQScK6bR21XeAK4JyGLqSxbd70BZdZKYH5U+aP0LCldarbxXiQA1bv5yDWAT
 0NStlYdsywI/5mKIHN+xosRDWW96+2oIcg5mYX+lODTs6KxcC79FNJ1pcY71kBWvHyxPNFCW8rdN5
 1tHpwLeuIN9/Ww==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pTLpG-0001Ei-6o; Sat, 18 Feb 2023 06:56:22 -0500
Date: Sat, 18 Feb 2023 13:56:24 +0200
Message-Id: <83cz67yyon.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
In-Reply-To: <871qmnky3b.fsf@localhost> (message from Ihor Radchenko on Sat,
 18 Feb 2023 11:32:56 +0000)
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@HIDDEN>
 <87y1urybt6.fsf@localhost> <837d2bbr2s.fsf@HIDDEN>
 <87edwjy77h.fsf@localhost> <831qsjboy0.fsf@HIDDEN>
 <87v8puw945.fsf@localhost> <838rmq9rfr.fsf@HIDDEN>
 <837d2a9qcu.fsf@HIDDEN> <875yhtw3ed.fsf@localhost>
 <CADwFkmmEDXzTt18aNAfib1+Cm+Uzia83O6Bd6OnT-nxA9B7o3g@HIDDEN>
 <831qmo146g.fsf@HIDDEN>
 <CADwFkm=Ju0k+6oA82v7TOaDFajqchgbWjJoTavdSJ4nHo3DUbw@HIDDEN>
 <83wn4fzcl5.fsf@HIDDEN>
 <CADwFkm=veDinWeM8CGPOGjVAnekUPRs+pXyjCMEV5za2s5eYiQ@HIDDEN>
 <83lekvz605.fsf@HIDDEN> <871qmnky3b.fsf@localhost>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org, stefankangas@HIDDEN, yantar92@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Ihor Radchenko <yantar92@HIDDEN>
> Cc: Stefan Kangas <stefankangas@HIDDEN>, yantar92@HIDDEN,
>  57693 <at> debbugs.gnu.org
> Date: Sat, 18 Feb 2023 11:32:56 +0000
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> >>     (defun insert-char-safely (ch repl)
> >>       "Insert character CH, if it can be displayed; otherwise insert REPL.
> >>     On TTY frames, always insert REPL."
> >>       (if (not (display-graphic-p))
> >>           (insert repl)
> >>         (insert ch)
> >>         (unless (font-at (1- (point)))
> >>           (delete-char -1)
> >>           (insert repl))))
> >
> > We could, but IME typical uses of fancy characters do not insert them
> > into a buffer, but use them in header-line, overlay strings, and
> > suchlikes.
> 
> `font-at' accepts optional third argument STRING.
> For example, (font-at 0 nil "🧠a")

My comment was because Stefan suggested a function that inserts a
character into a buffer, not because font-at by default reports about
a character at point.

> As an alternative thought, may Emacs display engine accept a text
> property like 'display-alternative to display some fallback
> character/string if some parts of the displayed text cannot be
> displayed?

We already have something like that: see glyphless-char-display and
glyphless-char-display-mode.  The problem is that (a) on GUI displays
the replacement will be displayed in a box; (b) the replacement must
be an ASCII character; and (c) the char-table we use for that is
global, i.e. it affects the entire session.  But if someone wants a
more flexible feature which lifts some of those restrictions, that's
the place to start nonetheless.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 18 Feb 2023 11:35:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 18 06:35:05 2023
Received: from localhost ([127.0.0.1]:42649 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pTLUe-0000xX-T2
	for submit <at> debbugs.gnu.org; Sat, 18 Feb 2023 06:35:05 -0500
Received: from mout01.posteo.de ([185.67.36.65]:48463)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1pTLUd-0000wy-Ek
 for 57693 <at> debbugs.gnu.org; Sat, 18 Feb 2023 06:35:03 -0500
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id EB76524032B
 for <57693 <at> debbugs.gnu.org>; Sat, 18 Feb 2023 12:34:57 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1676720098; bh=DF14bWFSamx9WtqoxeIJfUHWXrKmGhPkAEjxdwd85eQ=;
 h=From:To:Cc:Subject:Date:From;
 b=OoMa98NDmuQFJGgMe4bhpqf5nr87+zVhNOmgKNXtagr8KimGWb9HXarYJklbIwkt7
 uuOKnKiibNbjkQiS2FZ+NS+JVHrsOrZXtOJo0BuV79qf6kyPONdtmglwBFQ19Af0sT
 Gc4CdUSw9pOQf3TmeItDfXkCnMefw9fdXNjFaYOTFmn/CnTlQBA1PrUi61d9FACSNG
 gxeroFdBpBqtQIFCo6wpog/YvOco1gPuT5BUhZJgbuggDAahajvth5RW0Y0NJTMIvg
 li9cGwV3h4MqWnWHemt55A0uGd+xRGxFLd/B2mpf9C+mNJQLdfpr9fErqFfvfzc9fU
 O7FDrmLtJAaXA==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4PJmnD5xwfz6tm5;
 Sat, 18 Feb 2023 12:34:56 +0100 (CET)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
In-Reply-To: <83wn4fzcl5.fsf@HIDDEN>
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@HIDDEN>
 <87y1urybt6.fsf@localhost> <837d2bbr2s.fsf@HIDDEN>
 <87edwjy77h.fsf@localhost> <831qsjboy0.fsf@HIDDEN>
 <87v8puw945.fsf@localhost> <838rmq9rfr.fsf@HIDDEN>
 <837d2a9qcu.fsf@HIDDEN> <875yhtw3ed.fsf@localhost>
 <CADwFkmmEDXzTt18aNAfib1+Cm+Uzia83O6Bd6OnT-nxA9B7o3g@HIDDEN>
 <831qmo146g.fsf@HIDDEN>
 <CADwFkm=Ju0k+6oA82v7TOaDFajqchgbWjJoTavdSJ4nHo3DUbw@HIDDEN>
 <83wn4fzcl5.fsf@HIDDEN>
Date: Sat, 18 Feb 2023 11:35:33 +0000
Message-ID: <87y1ovjjei.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org, Stefan Kangas <stefankangas@HIDDEN>,
 yantar92@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

> If you need to care for TTY frames, that problem has no known solution
> that works for all terminal emulators.  So using fancy characters in
> general-purpose Emacs features is a problem that cannot be solved
> programmatically, or at least we don't currently know how to do that.

I am not sure if it is relevant, but I see
https://unix.stackexchange.com/questions/184345/detect-how-much-of-unicode-my-terminal-supports-even-through-screen

May it be something of use for Emacs?

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 18 Feb 2023 11:32:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 18 06:32:28 2023
Received: from localhost ([127.0.0.1]:42634 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pTLS8-0000sq-6u
	for submit <at> debbugs.gnu.org; Sat, 18 Feb 2023 06:32:28 -0500
Received: from mout02.posteo.de ([185.67.36.66]:42293)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1pTLS6-0000s8-8E
 for 57693 <at> debbugs.gnu.org; Sat, 18 Feb 2023 06:32:26 -0500
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 6DF212403C6
 for <57693 <at> debbugs.gnu.org>; Sat, 18 Feb 2023 12:32:20 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1676719940; bh=4vup+r6BAOX/XFjtcJ2AT6clsX1bT/e4zayrqzB9Rmg=;
 h=From:To:Cc:Subject:Date:From;
 b=dLPkY3CTv2O8flMATbZ61umX073vE9cOrqR0evTRbU+Vjlm45IGJf2aPb4owiIuLP
 BL4ygFRYHMCVAIM4nPr54/RSJxCnGOz0P7Wa6lEQFZyPux3UnwQ8E48fl14RRdbwwb
 /iFxPA1HoJTn2mSQ2JRTTpE+qYIElpn2KeO6yQc8QxQ3GS6Aj852LnI0S7u+fSNQBu
 vCYCD9c8cUiuvy9OrGwaaeSU6EQlv0Q8qeMhkYtfrfTXGODszGsG5QOCbKExoSbZb5
 ZW9Fbd/DKP9RBLcpbp8mY6wAtpKsDn30TV0DkAN88maB4k1rqmhQ3H348fl7oTRFQ3
 MZmYvkEazM8Nw==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4PJmkC2Vrxz9rxF;
 Sat, 18 Feb 2023 12:32:19 +0100 (CET)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
In-Reply-To: <83lekvz605.fsf@HIDDEN>
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@HIDDEN>
 <87y1urybt6.fsf@localhost> <837d2bbr2s.fsf@HIDDEN>
 <87edwjy77h.fsf@localhost> <831qsjboy0.fsf@HIDDEN>
 <87v8puw945.fsf@localhost> <838rmq9rfr.fsf@HIDDEN>
 <837d2a9qcu.fsf@HIDDEN> <875yhtw3ed.fsf@localhost>
 <CADwFkmmEDXzTt18aNAfib1+Cm+Uzia83O6Bd6OnT-nxA9B7o3g@HIDDEN>
 <831qmo146g.fsf@HIDDEN>
 <CADwFkm=Ju0k+6oA82v7TOaDFajqchgbWjJoTavdSJ4nHo3DUbw@HIDDEN>
 <83wn4fzcl5.fsf@HIDDEN>
 <CADwFkm=veDinWeM8CGPOGjVAnekUPRs+pXyjCMEV5za2s5eYiQ@HIDDEN>
 <83lekvz605.fsf@HIDDEN>
Date: Sat, 18 Feb 2023 11:32:56 +0000
Message-ID: <871qmnky3b.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org, Stefan Kangas <stefankangas@HIDDEN>,
 yantar92@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Eli Zaretskii <eliz@HIDDEN> writes:

>>     (defun insert-char-safely (ch repl)
>>       "Insert character CH, if it can be displayed; otherwise insert REP=
L.
>>     On TTY frames, always insert REPL."
>>       (if (not (display-graphic-p))
>>           (insert repl)
>>         (insert ch)
>>         (unless (font-at (1- (point)))
>>           (delete-char -1)
>>           (insert repl))))
>
> We could, but IME typical uses of fancy characters do not insert them
> into a buffer, but use them in header-line, overlay strings, and
> suchlikes.

`font-at' accepts optional third argument STRING.
For example, (font-at 0 nil "=F0=9F=A7=A0a")

I am not sure how reliable this approach with string is though.

As an alternative thought, may Emacs display engine accept a text
property like 'display-alternative to display some fallback
character/string if some parts of the displayed text cannot be
displayed?

--=20
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 18 Feb 2023 09:18:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 18 04:18:25 2023
Received: from localhost ([127.0.0.1]:42469 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pTJMP-0005NC-Hb
	for submit <at> debbugs.gnu.org; Sat, 18 Feb 2023 04:18:25 -0500
Received: from eggs.gnu.org ([209.51.188.92]:32906)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pTJMN-0005Mv-SW
 for 57693 <at> debbugs.gnu.org; Sat, 18 Feb 2023 04:18:24 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pTJMI-00056m-HC; Sat, 18 Feb 2023 04:18:18 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=7ZqO/iPHa6sHba0p/tioS1HtclcK7UzOLlO0hdLFQcI=; b=RtHjH4TRLkF3
 jYDD1RwNMpLxcN7xL2LGbVneVXbPJ58imnXORKtZBVfpvGOwKwPT1HANip7JWs/XqfAoKiAUvWwfu
 o1qklOb+rE0lgAQJ+uUohhIh4me8GYu8suxgRib5L1rulQIteTFbD+mB1vEPb0UkMf8om+z/4RHXF
 7TPcHg2A2SXQyiA5RV1hcy2nPXO8yKHL2+rm+2fIFdGMIYgTqgdt4JA1btpyH2Zuk8opdbPz7Cq3/
 LAElS95m2WqPQKUfebg2PMrv5B+4BtfDtK/Gv41/UpU31v9+Nhg7E2KMJhk0elVDMgjdT5NlM3Tqo
 RP1p9B0dA4+SBEu2k5oaAQ==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pTJMH-0000L6-SB; Sat, 18 Feb 2023 04:18:18 -0500
Date: Sat, 18 Feb 2023 11:18:18 +0200
Message-Id: <83lekvz605.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <CADwFkm=veDinWeM8CGPOGjVAnekUPRs+pXyjCMEV5za2s5eYiQ@HIDDEN>
 (message from Stefan Kangas on Sat, 18 Feb 2023 01:00:38 -0800)
Subject: Re: bug#57693: 29.0.50;
 Is there a more reliable version of `char-displayable-p'?
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@HIDDEN> <87y1urybt6.fsf@localhost>
 <837d2bbr2s.fsf@HIDDEN> <87edwjy77h.fsf@localhost> <831qsjboy0.fsf@HIDDEN>
 <87v8puw945.fsf@localhost> <838rmq9rfr.fsf@HIDDEN> <837d2a9qcu.fsf@HIDDEN>
 <875yhtw3ed.fsf@localhost>
 <CADwFkmmEDXzTt18aNAfib1+Cm+Uzia83O6Bd6OnT-nxA9B7o3g@HIDDEN>
 <831qmo146g.fsf@HIDDEN>
 <CADwFkm=Ju0k+6oA82v7TOaDFajqchgbWjJoTavdSJ4nHo3DUbw@HIDDEN>
 <83wn4fzcl5.fsf@HIDDEN>
 <CADwFkm=veDinWeM8CGPOGjVAnekUPRs+pXyjCMEV5za2s5eYiQ@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57693
Cc: yantar92@HIDDEN, 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Stefan Kangas <stefankangas@HIDDEN>
> Date: Sat, 18 Feb 2023 01:00:38 -0800
> Cc: yantar92@HIDDEN, 57693 <at> debbugs.gnu.org
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> > That's for GUI displays only.  And it's for strings, not characters.
> > To test a single character, you don't need a separate function, IMO,
> > you just need to use the test that is the core of that code.
> [...]
> > If you need to care for TTY frames, that problem has no known solution
> > that works for all terminal emulators.  So using fancy characters in
> > general-purpose Emacs features is a problem that cannot be solved
> > programmatically, or at least we don't currently know how to do that.
> 
> Thanks, those are useful clarifications.  But could we not just fall
> back to the replacement on TTY frames instead?  Something like:
> 
>     (defun insert-char-safely (ch repl)
>       "Insert character CH, if it can be displayed; otherwise insert REPL.
>     On TTY frames, always insert REPL."
>       (if (not (display-graphic-p))
>           (insert repl)
>         (insert ch)
>         (unless (font-at (1- (point)))
>           (delete-char -1)
>           (insert repl))))

We could, but IME typical uses of fancy characters do not insert them
into a buffer, but use them in header-line, overlay strings, and
suchlikes.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 18 Feb 2023 09:00:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 18 04:00:47 2023
Received: from localhost ([127.0.0.1]:42442 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pTJ5K-0004tF-N5
	for submit <at> debbugs.gnu.org; Sat, 18 Feb 2023 04:00:47 -0500
Received: from mail-oi1-f171.google.com ([209.85.167.171]:46798)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1pTJ5I-0004t0-Ht
 for 57693 <at> debbugs.gnu.org; Sat, 18 Feb 2023 04:00:45 -0500
Received: by mail-oi1-f171.google.com with SMTP id w7so335766oik.13
 for <57693 <at> debbugs.gnu.org>; Sat, 18 Feb 2023 01:00:44 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=JFVZYr2cPq9mOC+i/FoN294Rr8Vk38nHEgRlp1oiVV4=;
 b=FuAAoZ8nDQ00x0lFqfd72cKCizbX3KcNXQLjkV1d31AwHGVWSawLWZp66YyWHNKfFE
 F90DXxjS9ox2dby2OprDRGuUzCvskTrrKqADmC+D458WyadZjoIu9XCrHpFcAtZv9MX8
 Ypd4aIvKUBeNAzUFO+8CNDMQw6qXKIuZ9L3jtTVOyJmRUVtqURYCIMCqWrikV1D3h9nz
 wYmQ0r/BsWdUb94I3wCOkcLWn6VfEvLMM46zjQI5O6Il4ivZCiTYiacxFtmnqq9oQWgk
 phnk3pVS5YVrnMMoAbmFrS9Gpi8/vMUt0rqPi/WQo9k+BartS7DqBprknkFJHoGudqeh
 CxRw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=JFVZYr2cPq9mOC+i/FoN294Rr8Vk38nHEgRlp1oiVV4=;
 b=owUtYvpvZeVkC87nVWEOY/6aOJoGU7jPlRNKKtfH4vhEcJFBHuvh3RQI4eKWSlFqwd
 VFqxcunCFFX6JXh3zyNwb0kmzB/ukcs2y9VZ+HklxpXivZvwW7uVeyn1evmpCJbP2HQk
 pBoJQXeN4pKiMH2272UNahZ6vmAirutkikMeZOOD9cT4S0rGtqdV0FCZuQl9OslrZQcV
 hVRjkuQhHLlh3dzI/YLDllLK2lKDFfEsQe8r9YjzsnV5GTD4p4m7MpVszcf+7f2byqZj
 3fKob0Qgv96DGBYT0m0T8+c6RNkXsFVfdx2tD3NS8Ebjfv5iRUdyqeOG1ych61nTtnO3
 dx9w==
X-Gm-Message-State: AO0yUKWGPrEdtWeF535aSuJy4TbhXKxdIy9lP+46WWfTvWTH0GpE1jc6
 7rb2RFac0YiNZNeXjUJclpVnwvh2KDf8irdT+84=
X-Google-Smtp-Source: AK7set9nawzfLDxizwnvq8IJ9/GeHsfCQYO4HU2VfiziAnfDxJefhxRB9xImz0YeWccfy0kK4egEnim24IAiavF18Qo=
X-Received: by 2002:a05:6808:11c5:b0:378:3f53:9e8 with SMTP id
 p5-20020a05680811c500b003783f5309e8mr777369oiv.291.1676710838762; Sat, 18 Feb
 2023 01:00:38 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Sat, 18 Feb 2023 01:00:38 -0800
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <83wn4fzcl5.fsf@HIDDEN>
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@HIDDEN> <87y1urybt6.fsf@localhost>
 <837d2bbr2s.fsf@HIDDEN> <87edwjy77h.fsf@localhost> <831qsjboy0.fsf@HIDDEN>
 <87v8puw945.fsf@localhost> <838rmq9rfr.fsf@HIDDEN> <837d2a9qcu.fsf@HIDDEN>
 <875yhtw3ed.fsf@localhost>
 <CADwFkmmEDXzTt18aNAfib1+Cm+Uzia83O6Bd6OnT-nxA9B7o3g@HIDDEN>
 <831qmo146g.fsf@HIDDEN>
 <CADwFkm=Ju0k+6oA82v7TOaDFajqchgbWjJoTavdSJ4nHo3DUbw@HIDDEN>
 <83wn4fzcl5.fsf@HIDDEN>
X-Hashcash: 1:20:230218:57693 <at> debbugs.gnu.org::fCNIjMlXkvxGnrr1:1YPW
MIME-Version: 1.0
Date: Sat, 18 Feb 2023 01:00:38 -0800
Message-ID: <CADwFkm=veDinWeM8CGPOGjVAnekUPRs+pXyjCMEV5za2s5eYiQ@HIDDEN>
Subject: Re: bug#57693: 29.0.50;
 Is there a more reliable version of `char-displayable-p'?
To: Eli Zaretskii <eliz@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 57693
Cc: yantar92@HIDDEN, 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

> That's for GUI displays only.  And it's for strings, not characters.
> To test a single character, you don't need a separate function, IMO,
> you just need to use the test that is the core of that code.
[...]
> If you need to care for TTY frames, that problem has no known solution
> that works for all terminal emulators.  So using fancy characters in
> general-purpose Emacs features is a problem that cannot be solved
> programmatically, or at least we don't currently know how to do that.

Thanks, those are useful clarifications.  But could we not just fall
back to the replacement on TTY frames instead?  Something like:

    (defun insert-char-safely (ch repl)
      "Insert character CH, if it can be displayed; otherwise insert REPL.
    On TTY frames, always insert REPL."
      (if (not (display-graphic-p))
          (insert repl)
        (insert ch)
        (unless (font-at (1- (point)))
          (delete-char -1)
          (insert repl))))




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 18 Feb 2023 06:56:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Feb 18 01:56:16 2023
Received: from localhost ([127.0.0.1]:42251 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pTH8p-0001Ss-Mo
	for submit <at> debbugs.gnu.org; Sat, 18 Feb 2023 01:56:16 -0500
Received: from eggs.gnu.org ([209.51.188.92]:50704)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pTH8o-0001Sg-6y
 for 57693 <at> debbugs.gnu.org; Sat, 18 Feb 2023 01:56:14 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pTH8i-0001qK-JG; Sat, 18 Feb 2023 01:56:08 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=RS8+HoWRlKq0EVFg87iETmzFUg2udark7KVYvc/hdnw=; b=W3jV3rSO4gYq
 Om6C5604Ya+4QqOlbAxlMB0EfK3jvOWB3yJeIlyPBedwYztR40c4x2HaxYtvNI20yOMSJNthAu+I9
 HlxVaqReUXfYptxlTlbMQpjDxlaADpAlLhkqKNHr97Qa9ef8t0MkKwQfcVPG1HSYLPa796hlLOieJ
 Bt+CPY0R5WldmMaAsXEZpkC5+FkX0KnrC8pxwskTU0MXof6DDH9M5SZ56+Wl5ymOOGPyY7Fey4IIS
 8Cxs+Mc2X+BXTqvEkAT+sY38I65FhtLM102L4c/fFOYYDx2lXXe06i5EYcjeLSAzT8Ci+BgWT/WEB
 yxNysCpdd9HxLTZyyE/VOw==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pTH8e-0000k0-4d; Sat, 18 Feb 2023 01:56:08 -0500
Date: Sat, 18 Feb 2023 08:56:06 +0200
Message-Id: <83wn4fzcl5.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <CADwFkm=Ju0k+6oA82v7TOaDFajqchgbWjJoTavdSJ4nHo3DUbw@HIDDEN>
 (message from Stefan Kangas on Fri, 17 Feb 2023 14:31:49 -0800)
Subject: Re: bug#57693: 29.0.50;
 Is there a more reliable version of `char-displayable-p'?
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@HIDDEN> <87y1urybt6.fsf@localhost>
 <837d2bbr2s.fsf@HIDDEN> <87edwjy77h.fsf@localhost> <831qsjboy0.fsf@HIDDEN>
 <87v8puw945.fsf@localhost> <838rmq9rfr.fsf@HIDDEN> <837d2a9qcu.fsf@HIDDEN>
 <875yhtw3ed.fsf@localhost>
 <CADwFkmmEDXzTt18aNAfib1+Cm+Uzia83O6Bd6OnT-nxA9B7o3g@HIDDEN>
 <831qmo146g.fsf@HIDDEN>
 <CADwFkm=Ju0k+6oA82v7TOaDFajqchgbWjJoTavdSJ4nHo3DUbw@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57693
Cc: yantar92@HIDDEN, 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Stefan Kangas <stefankangas@HIDDEN>
> Date: Fri, 17 Feb 2023 14:31:49 -0800
> Cc: yantar92@HIDDEN, 57693 <at> debbugs.gnu.org
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> > Something like what?  If you want to suggest some specific function,
> > please show the proposed code, and let's take it from there.
> > Otherwise, this bug discussion was long and considered several issues,
> > and it is hard to know what you have in mind.
> 
> The code is here:
> 
>     https://debbugs.gnu.org/cgi/bugreport.cgi?bug=57693#71

That's for GUI displays only.  And it's for strings, not characters.
To test a single character, you don't need a separate function, IMO,
you just need to use the test that is the core of that code.

> > And what is the problem with using char-displayable-p in that case?
> 
> My concern is that `char-displayable-p' will return t even if the
> character is not displayable.

If you need to care for TTY frames, that problem has no known solution
that works for all terminal emulators.  So using fancy characters in
general-purpose Emacs features is a problem that cannot be solved
programmatically, or at least we don't currently know how to do that.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 17 Feb 2023 22:31:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 17 17:31:58 2023
Received: from localhost ([127.0.0.1]:41808 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pT9Go-0004Qp-50
	for submit <at> debbugs.gnu.org; Fri, 17 Feb 2023 17:31:58 -0500
Received: from mail-oa1-f49.google.com ([209.85.160.49]:45960)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1pT9Gm-0004Qa-Ef
 for 57693 <at> debbugs.gnu.org; Fri, 17 Feb 2023 17:31:56 -0500
Received: by mail-oa1-f49.google.com with SMTP id
 586e51a60fabf-171873034c3so2831863fac.12
 for <57693 <at> debbugs.gnu.org>; Fri, 17 Feb 2023 14:31:56 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=PWdedzyjOxRlfaVD26Lv6xrRhSB2F5XqtiyJ3cPXe7k=;
 b=P9o08OodgQOo8FydPGeS6EOP1euqzWlcul1IrQf+c7Zf45ye7WMAfhH18o6BdT7Q4G
 BtPUYOYYJLTK7vtM4OkqMe5DIn1wvf4k228i9f1GCH0znV5jQyw9qUtDzOqLL4TwZpi6
 FhzLKetiCrfD5ws/Y6r8PQI3RYbp/2qrtFxAEwWoEpO2J3sYypMRGlVxgX2yxGLq4xS4
 3YO8zCsuAE8dhdcMRtIv2GqkkPPoPgXt1Byz7SVbmDWWtuFmfkzT2h3GgfzZ0BdE5GAb
 a7tOqJNpIGx/Zwf8SnCE1GOUpAKLGHlYAa3m0kS8xs5WAnuchCy8bb7jJpkjHGaC3Mhn
 Lz2Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:x-gm-message-state:from:to
 :cc:subject:date:message-id:reply-to;
 bh=PWdedzyjOxRlfaVD26Lv6xrRhSB2F5XqtiyJ3cPXe7k=;
 b=hiNSeUzVILlvDyvlZ3JJIJR+N03vn+S2RYCzXn4nxSaDPwW/XosOp58T1wUpk/q9Dw
 3rnZ29Seja7hqZepbvF1gsZ0fX1F4TC0PFGCcBxCPzDpSDv281smo7IXV18bENUnL55M
 JMAx0uPaIDWOGt8MOuEjlNxYka0pGVzF1PSJf4wEKQecVA3VvGtT8SjH5EfUaI9u9Wjn
 OqclX2aVSBQMScc3HTyS2cOLepf+E7/1A1+aNjkLYBCLGbfR4hI6tsDVikNYKYqkMYbc
 IrlQweKGV7X4wUA1IFQZxyjnYXz3Bp9WG08s6a0B6wsQ4AlPiPU1Um3elJ+KKx8Lu7q0
 EMkQ==
X-Gm-Message-State: AO0yUKWc6c78bRHAGMO2Q+37HlVM4zvZDCaZpprb7KKeaO3uEKas5D2b
 IQxSWTU9lv6FS5Xv2vq+bUvJDQVWIJSQQrMi6kc=
X-Google-Smtp-Source: AK7set8HchUVUudEIBxDdMcoqcKJT1k0kQkbXMvcZpnuaWrOheSFozddabBcH6zRMaXbbdbCE5Zcx54BFcp3yHiHdCw=
X-Received: by 2002:a05:6870:968b:b0:16f:edf8:6210 with SMTP id
 o11-20020a056870968b00b0016fedf86210mr322276oaq.291.1676673110690; Fri, 17
 Feb 2023 14:31:50 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Fri, 17 Feb 2023 14:31:49 -0800
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <831qmo146g.fsf@HIDDEN>
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@HIDDEN> <87y1urybt6.fsf@localhost>
 <837d2bbr2s.fsf@HIDDEN> <87edwjy77h.fsf@localhost> <831qsjboy0.fsf@HIDDEN>
 <87v8puw945.fsf@localhost> <838rmq9rfr.fsf@HIDDEN> <837d2a9qcu.fsf@HIDDEN>
 <875yhtw3ed.fsf@localhost>
 <CADwFkmmEDXzTt18aNAfib1+Cm+Uzia83O6Bd6OnT-nxA9B7o3g@HIDDEN>
 <831qmo146g.fsf@HIDDEN>
X-Hashcash: 1:20:230217:yantar92@HIDDEN::wSg/0s+XJ+Wr2P8p:7jlq
MIME-Version: 1.0
Date: Fri, 17 Feb 2023 14:31:49 -0800
Message-ID: <CADwFkm=Ju0k+6oA82v7TOaDFajqchgbWjJoTavdSJ4nHo3DUbw@HIDDEN>
Subject: Re: bug#57693: 29.0.50;
 Is there a more reliable version of `char-displayable-p'?
To: Eli Zaretskii <eliz@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 57693
Cc: yantar92@HIDDEN, 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

> Something like what?  If you want to suggest some specific function,
> please show the proposed code, and let's take it from there.
> Otherwise, this bug discussion was long and considered several issues,
> and it is hard to know what you have in mind.

The code is here:

    https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D57693#71

>> I can see a need for it in many more places.  For example, I'm looking
>> into improving the header-line-format in calc-mode with some Unicode
>> characters instead of a simple en dash (i.e. "=E2=80=92" instead of "-")=
.
>
> And what is the problem with using char-displayable-p in that case?

My concern is that `char-displayable-p' will return t even if the
character is not displayable.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 17 Feb 2023 19:29:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 17 14:29:35 2023
Received: from localhost ([127.0.0.1]:41602 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pT6QI-0005q9-Tn
	for submit <at> debbugs.gnu.org; Fri, 17 Feb 2023 14:29:35 -0500
Received: from eggs.gnu.org ([209.51.188.92]:38452)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pT6QH-0005pt-Ey
 for 57693 <at> debbugs.gnu.org; Fri, 17 Feb 2023 14:29:33 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pT6QB-0002Jo-M0; Fri, 17 Feb 2023 14:29:28 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=3RKuRByxvO6ujlrtktiGvT3XP8Vgj5Ox1ZuZOFSnTaA=; b=kVxWKr9nYvBs4bIpb66z
 R+YhsbncclYC6fpi6GDo9qMUD+cjUFEenQQVp56/gNWV4m4IVr2gx4OcD3JM9NnrFN7S5YSF9YkpD
 wEAOkLIFB80PRpV71E7Rrv/osaP8F+Xxr1/WY1W2Vytoq95F5QKRA0q1GE/+p2H98CSxR6OZIv4uY
 3E6SeTOoJDci+Q+bp7WkVf4YeZyJ+SNmXOwhsoFhmxN9kP+dXzCHNqJHKl1cem/nKvkhKV/sjjAn3
 c56SYteJzXSJvi4YLz6bu9wCMNyd+gikQhQTatuBstci8tAXgQUnNbd8kCUfIaFnMqak6cOweYCfP
 RVqYdPXor2N11Q==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pT6QA-0006IT-RQ; Fri, 17 Feb 2023 14:29:27 -0500
Date: Fri, 17 Feb 2023 21:29:27 +0200
Message-Id: <831qmo146g.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <CADwFkmmEDXzTt18aNAfib1+Cm+Uzia83O6Bd6OnT-nxA9B7o3g@HIDDEN>
 (message from Stefan Kangas on Fri, 17 Feb 2023 11:18:45 -0800)
Subject: Re: bug#57693: 29.0.50;
 Is there a more reliable version of `char-displayable-p'?
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@HIDDEN> <87y1urybt6.fsf@localhost>
 <837d2bbr2s.fsf@HIDDEN> <87edwjy77h.fsf@localhost> <831qsjboy0.fsf@HIDDEN>
 <87v8puw945.fsf@localhost> <838rmq9rfr.fsf@HIDDEN> <837d2a9qcu.fsf@HIDDEN>
 <875yhtw3ed.fsf@localhost>
 <CADwFkmmEDXzTt18aNAfib1+Cm+Uzia83O6Bd6OnT-nxA9B7o3g@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57693
Cc: yantar92@HIDDEN, 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Stefan Kangas <stefankangas@HIDDEN>
> Date: Fri, 17 Feb 2023 11:18:45 -0800
> Cc: 57693 <at> debbugs.gnu.org
> 
> Ihor Radchenko <yantar92@HIDDEN> writes:
> 
> > I am thinking about something like below (to insert string, not a char),
> >
> > (defun org-insert-displayable (&rest strings)
> [snip]
> 
> Should we put something like this in subr.el or perhaps subr-x.el?

Something like what?  If you want to suggest some specific function,
please show the proposed code, and let's take it from there.
Otherwise, this bug discussion was long and considered several issues,
and it is hard to know what you have in mind.

> I can see a need for it in many more places.  For example, I'm looking
> into improving the header-line-format in calc-mode with some Unicode
> characters instead of a simple en dash (i.e. "β€’" instead of "-").

And what is the problem with using char-displayable-p in that case?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 17 Feb 2023 19:18:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 17 14:18:54 2023
Received: from localhost ([127.0.0.1]:41582 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pT6Fx-0005ZQ-Re
	for submit <at> debbugs.gnu.org; Fri, 17 Feb 2023 14:18:54 -0500
Received: from mail-ot1-f45.google.com ([209.85.210.45]:42824)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1pT6Fv-0005ZC-Pi
 for 57693 <at> debbugs.gnu.org; Fri, 17 Feb 2023 14:18:52 -0500
Received: by mail-ot1-f45.google.com with SMTP id
 cd10-20020a056830620a00b0068d4b30536aso381797otb.9
 for <57693 <at> debbugs.gnu.org>; Fri, 17 Feb 2023 11:18:51 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=612tya7/dICQahEwEDLqDgBL1LcCXnbseqY1+8Hc5iQ=;
 b=kQZvxF8B8SC9HPlD6bXl+sPhPQVGqpaVI5dOqoSLPDLfoHnsQNtdcvpbJVDmTU/rlX
 plJ7nrhTc4M9OdJYEWGt828WrNrRLFzFExnfxC74X1STTqKA7NujB/RFib+OjV9TlPYt
 olu2xv2IZGAfiBMPzF/q6m2CQlRZvOQlmSjc4d7DaCWUCF59AD48UMX5ZlONap2eawB/
 A6iMDQ616fPcHloUBSP0iikrJs+r9TsxzgYPRVxa0ZkoudaU3hw0rfLJM6yZNL/e0aBC
 bOfykpSsZGmEPuqawOlE+wmdkyN4P5MdGFm7NW2cmZ8GLetczl3Wusatx8/KeFWQ8DGQ
 GLBw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:x-gm-message-state:from:to
 :cc:subject:date:message-id:reply-to;
 bh=612tya7/dICQahEwEDLqDgBL1LcCXnbseqY1+8Hc5iQ=;
 b=WE4oYeB7qxGa1pqkh/T5tapkWOL7LKXTLjS5RaS7aZ4SXXrzOcpv7uw2kiLDhHHcms
 7lSRi+EbPNRXA4OvQCHGzOlTmQesNLUWBycCiQxWNy9WOvdmaft8UdRbwwLd6xDn2ih6
 0F97bfHN3mbntCLV+xR4bZ7prgh73Y1jaOERkz5K3Lj9jE4CYfm7JiBmi30QOU6R7lit
 keDjnfRBcQ6QICzGN62FpNiPAOz5IsFgsM4uQdBN4xiyv5cwEh0xwmHs6ZtEJRvgBH/p
 CVMIldns3vQJ4ruoK+9qE2taokg/4rLIYNlvBmjZ9MgCeym5n7fELWt52zb2+MM/SO7G
 7OxA==
X-Gm-Message-State: AO0yUKXEHTOmklpfxe0RlBV1dVduMMq95Qq3udi8kfwy0dXflKQ4bv9e
 OB0ejdI0iFunp9OoWinoR6XW9hzDzVMMkNdTjFo=
X-Google-Smtp-Source: AK7set/OqNit4akJa9pKABpIa/Zl1l7+5qBqiyB0pzy33LykM8pB/hsU4ucrMYRDLKouMQpu8XD295qtfgu1Ab6Qe5c=
X-Received: by 2002:a05:6830:3749:b0:68d:3fc4:a1e6 with SMTP id
 bm9-20020a056830374900b0068d3fc4a1e6mr508260otb.1.1676661525862; Fri, 17 Feb
 2023 11:18:45 -0800 (PST)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Fri, 17 Feb 2023 11:18:45 -0800
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <875yhtw3ed.fsf@localhost>
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@HIDDEN> <87y1urybt6.fsf@localhost>
 <837d2bbr2s.fsf@HIDDEN> <87edwjy77h.fsf@localhost> <831qsjboy0.fsf@HIDDEN>
 <87v8puw945.fsf@localhost> <838rmq9rfr.fsf@HIDDEN> <837d2a9qcu.fsf@HIDDEN>
 <875yhtw3ed.fsf@localhost>
X-Hashcash: 1:20:230217:57693 <at> debbugs.gnu.org::hU+Gihd5hR1yMf/s:En8A
MIME-Version: 1.0
Date: Fri, 17 Feb 2023 11:18:45 -0800
Message-ID: <CADwFkmmEDXzTt18aNAfib1+Cm+Uzia83O6Bd6OnT-nxA9B7o3g@HIDDEN>
Subject: Re: bug#57693: 29.0.50;
 Is there a more reliable version of `char-displayable-p'?
To: Ihor Radchenko <yantar92@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Ihor Radchenko <yantar92@HIDDEN> writes:

> I am thinking about something like below (to insert string, not a char),
>
> (defun org-insert-displayable (&rest strings)
[snip]

Should we put something like this in subr.el or perhaps subr-x.el?

I can see a need for it in many more places.  For example, I'm looking
into improving the header-line-format in calc-mode with some Unicode
characters instead of a simple en dash (i.e. "=E2=80=92" instead of "-").




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 14 Sep 2022 02:43:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 13 22:43:35 2022
Received: from localhost ([127.0.0.1]:53251 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oYIND-0002yr-7w
	for submit <at> debbugs.gnu.org; Tue, 13 Sep 2022 22:43:35 -0400
Received: from eggs.gnu.org ([209.51.188.92]:49440)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1oYINC-0002yg-1n
 for 57693 <at> debbugs.gnu.org; Tue, 13 Sep 2022 22:43:34 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:60614)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oYIN6-0006bn-RF; Tue, 13 Sep 2022 22:43:28 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=wmiAh4pPNTslZUoy93lGyUo2WgQHKyVrw+Ur/50INRw=; b=cuQ4ArL0nQAM
 Ke/Z3r+zQnb/QW/naXTEvR3f0vD2iipnrM3tTAdXay9IaAxEFElgyErAyfOkgicGzwTvVQ3HeLZGa
 2enrkKn8i1tSCB2Gr7m9QpnRWYWDw3mKeU6f7vCnqTR4GgeliaD7nCZ5bkBsxreXqpxBcZT+mr5NG
 8KYDEq9qnSY7X/vgh2WpqbmC6KVq25HzmSfXxf4uXVOr/KL3bDvZ7+zk7+QolwyVDw2W5Bd2ibA0C
 1sqYy2iXmAAMh7IjoKL29JQMBmDJHzDQ8yFY9ivxbxjXxpc5PcUfFqrcqFzRCh3yRs5QHoF/rCeO3
 F5v8R+JCmd4AN5ETuZSiYA==;
Received: from [87.69.77.57] (port=1712 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oYIN5-0003NP-7n; Tue, 13 Sep 2022 22:43:28 -0400
Date: Wed, 14 Sep 2022 05:43:17 +0300
Message-Id: <83sfku3cca.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
In-Reply-To: <8735cuzpqc.fsf@localhost> (message from Ihor Radchenko on Wed,
 14 Sep 2022 09:52:59 +0800)
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@HIDDEN>
 <87y1urybt6.fsf@localhost> <837d2bbr2s.fsf@HIDDEN>
 <87edwjy77h.fsf@localhost> <831qsjboy0.fsf@HIDDEN>
 <87v8puw945.fsf@localhost> <838rmq9rfr.fsf@HIDDEN>
 <837d2a9qcu.fsf@HIDDEN> <875yhtw3ed.fsf@localhost>
 <83ills9741.fsf@HIDDEN> <878rmoujyx.fsf@localhost>
 <834jxb5xp6.fsf@HIDDEN> <8735cuzpqc.fsf@localhost>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Ihor Radchenko <yantar92@HIDDEN>
> Cc: 57693 <at> debbugs.gnu.org
> Date: Wed, 14 Sep 2022 09:52:59 +0800
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> > So an efficient method of testing this for terminal would be:
> >
> >   . if terminal-coding-system is UTF-8, call internal-char-font to see
> 
> On my side, (terminal-coding-system) returns 'utf-8-unix
> However, I imagine that other utf-8 variants may be returned, say, on
> Windows.
> 
> Is there some standard way to know is a coding system is utf-8 or not?

Yes, use coding-system-base.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 14 Sep 2022 01:52:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 13 21:52:15 2022
Received: from localhost ([127.0.0.1]:53208 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oYHZX-0001h7-E7
	for submit <at> debbugs.gnu.org; Tue, 13 Sep 2022 21:52:15 -0400
Received: from mail-pj1-f51.google.com ([209.85.216.51]:56122)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oYHZV-0001gq-2s
 for 57693 <at> debbugs.gnu.org; Tue, 13 Sep 2022 21:52:13 -0400
Received: by mail-pj1-f51.google.com with SMTP id fs14so13039340pjb.5
 for <57693 <at> debbugs.gnu.org>; Tue, 13 Sep 2022 18:52:13 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:from:to:cc:subject:date;
 bh=RIoYBr7VeJoyqx4Sq5aFq8E2Hplqye6gvKw5fdKcki8=;
 b=DTWy2KLOpjslZ9xsdDTIXUmmLT3fFFN5F8rHUDQEinpMWwLjAgxtgWWQf2iKLn+/sQ
 +bdBsQUFtP9Sew26CVYYjqQNqxUyAf3ezZ9UhsDhe2JR1/AWJfZdEaxhistIQ9P7wiO9
 KPZ5zAYPX6fSZb8OHHeG7/sUmRNy//71cgrh96oicq4lgrWK1f+v2d5zdvwM2lkWjvmn
 V0463q/vRdjggkskwKTDwr5dqUhcaUpL4x/M37tysZvw/EvDY7iMiqsEykRqzOVOM1l0
 bKXkNXsx2g08hF4AZXi0K3T4Tuzmk+039FcDjJavFmwWqShSEn7qZBVT8zj32449bMJl
 u6Pg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:x-gm-message-state:from:to:cc:subject:date;
 bh=RIoYBr7VeJoyqx4Sq5aFq8E2Hplqye6gvKw5fdKcki8=;
 b=F/6VLG+SCXWdnFYI0WI+lihRSd9ubmk9Sg6rd23qoIbJGqZcd44kJwsP2wjNygTsSY
 /4vE/jXPOxARwtYUMQ2aGPLJkHhlMo5a9QZ1vZLGM/Pu38b4MfoYZgt8hdJVOYSmD6Ey
 6G5FhiSrckSQX1h884AqUKpEkG1RDmAfbDCGimQWPBpjY2MUc+4G7DucRg0RmFODRsIJ
 gphmj33EpBLPa/lIVjWvUicy2Bi0CdJMwzlh6X3oTDmZxlIBTzv/VXUA57Hq0yTQURe/
 cdUHEvbParsX+v2Nhi8VqYP9sFb81Qp6rYmELJBlzR68K13DgCwZK1C1VdLo5OZNYJm9
 BWCg==
X-Gm-Message-State: ACgBeo3ZtdZoxDYc4YMtAKE3ZYUWNEnD7trmYkYsWdEVc5/cQqy3HvYU
 U4vyv72ZTvWzidHMSeWcE/U=
X-Google-Smtp-Source: AA6agR68+OZJogeSXQ8ZHxWCsBiJ5D58KD6CK4YC0HZ+SUs0tYDMqGKWm6+Z3vRkSrmpcg9uNVUaGQ==
X-Received: by 2002:a17:902:f816:b0:178:3bc6:dfd with SMTP id
 ix22-20020a170902f81600b001783bc60dfdmr9336436plb.10.1663120326149; 
 Tue, 13 Sep 2022 18:52:06 -0700 (PDT)
Received: from localhost ([2409:8970:a81:48f7:8ec6:81ff:fe70:339d])
 by smtp.gmail.com with ESMTPSA id
 x127-20020a626385000000b00537a6b81bb7sm8822229pfb.148.2022.09.13.18.52.04
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 13 Sep 2022 18:52:05 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
In-Reply-To: <834jxb5xp6.fsf@HIDDEN>
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@HIDDEN>
 <87y1urybt6.fsf@localhost> <837d2bbr2s.fsf@HIDDEN>
 <87edwjy77h.fsf@localhost> <831qsjboy0.fsf@HIDDEN>
 <87v8puw945.fsf@localhost> <838rmq9rfr.fsf@HIDDEN>
 <837d2a9qcu.fsf@HIDDEN> <875yhtw3ed.fsf@localhost>
 <83ills9741.fsf@HIDDEN> <878rmoujyx.fsf@localhost>
 <834jxb5xp6.fsf@HIDDEN>
Date: Wed, 14 Sep 2022 09:52:59 +0800
Message-ID: <8735cuzpqc.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

Eli Zaretskii <eliz@HIDDEN> writes:

> So an efficient method of testing this for terminal would be:
>
>   . if terminal-coding-system is UTF-8, call internal-char-font to see

On my side, (terminal-coding-system) returns 'utf-8-unix
However, I imagine that other utf-8 variants may be returned, say, on
Windows.

Is there some standard way to know is a coding system is utf-8 or not?

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 13 Sep 2022 11:19:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 13 07:19:39 2022
Received: from localhost ([127.0.0.1]:49040 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oY3x5-0002LX-Bg
	for submit <at> debbugs.gnu.org; Tue, 13 Sep 2022 07:19:39 -0400
Received: from eggs.gnu.org ([209.51.188.92]:48538)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1oY3x0-0002LF-OJ
 for 57693 <at> debbugs.gnu.org; Tue, 13 Sep 2022 07:19:38 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:53432)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oY3wv-0006PG-HY; Tue, 13 Sep 2022 07:19:29 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=Cw4z3cet3ZL9hZNvaBVPABdYpX8BdzOde30qY1ssrVI=; b=jZsnl3+xQiid
 VcBrqKSyrpQW2rPKL8fyYYNlg5xbRpj0GQ4pbBhTmRZElO5vTN8nnwhW/vflwSmmLlZUA4ofXdl11
 BrM850FFxBEC0c6DsUfheGYhRSAyZDCVfhSHYJ27uYNbTJtxfnOMNRqG5uzVWk5FDK7suJUaQNxGz
 bAXUMaNdP+pnSYQfZ10JBEinat8zagbGVwYtlIH1Ayq1M/LTlefUAR9YDwtdTarhtFTlrvuxoWAUm
 m5Zv8MucoXqGTVnheVHw3+YSmMa8ukvqI5kW3qAvxl7kM3UNA/px6icgh9b/1/+WDxWoRHlnIV2KM
 ahykIqmhUPtVIIeuYoidaA==;
Received: from [87.69.77.57] (port=3454 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oY3wf-0001FZ-Qp; Tue, 13 Sep 2022 07:19:23 -0400
Date: Tue, 13 Sep 2022 14:19:01 +0300
Message-Id: <834jxb5xp6.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
In-Reply-To: <878rmoujyx.fsf@localhost> (message from Ihor Radchenko on Tue,
 13 Sep 2022 09:44:06 +0800)
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@HIDDEN>
 <87y1urybt6.fsf@localhost> <837d2bbr2s.fsf@HIDDEN>
 <87edwjy77h.fsf@localhost> <831qsjboy0.fsf@HIDDEN>
 <87v8puw945.fsf@localhost> <838rmq9rfr.fsf@HIDDEN>
 <837d2a9qcu.fsf@HIDDEN> <875yhtw3ed.fsf@localhost>
 <83ills9741.fsf@HIDDEN> <878rmoujyx.fsf@localhost>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Ihor Radchenko <yantar92@HIDDEN>
> Cc: 57693 <at> debbugs.gnu.org
> Date: Tue, 13 Sep 2022 09:44:06 +0800
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> > If the terminal's encoding is UTF-8, and it doesn't support the method
> > we use to query about individual glyphs, char-displayable-p may return
> > non-nil when the character cannot be displayed, i.e. will show as an
> > empty box or something.  Otherwise, char-displayable-p does provide
> > the correct answer for TTY frames.
> 
> Do I understand correctly that:
> 1. `font-at' is not sufficient for terminals, and we also need to use
>    `char-displayable-p'
> 2. `char-displayable-p' works on many terminals but may be inaccurate in some

More or less.  More accurately:

 . font-at is not useful on text-mode frames
 . char-displayable-p, when invoked on text-mode frames, in most cases
   reports only whether the character can be safely encoded by
   terminal-coding-system
 . if terminal-coding-system is UTF-8, char-displayable-p will
   generally trivially return non-nil, unless the terminal supports
   queries about glyphs that it has for specific characters
 . the only terminal I know of that supports the above queries is the
   Linux console, which I think is not very popular among Emacs users
 . for terminals that do support such queries, you can use this:

      (internal-char-font nil CHAR)

   which will return a positive number if CHAR can be displayed,
   negative number if it cannot, or nil if the query is not supported.

So an efficient method of testing this for terminal would be:

  . if terminal-coding-system is UTF-8, call internal-char-font to see
    if the character is supported, and if it returns a number,
    consider the character supported if the number is positive, not
    supported otherwise
  . otherwise, if terminal-coding-system is UTF-8, consider character
    supported (and pray)
  . otherwise call char-displayable-p and judge by its value

This is more efficient than calling char-displayable-p because I
expect most terminals these days to use UTF-8 encoding, and for them
the above is optimized.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 13 Sep 2022 01:43:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 12 21:43:24 2022
Received: from localhost ([127.0.0.1]:48365 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oXuxP-0001pw-OW
	for submit <at> debbugs.gnu.org; Mon, 12 Sep 2022 21:43:24 -0400
Received: from mail-pl1-f175.google.com ([209.85.214.175]:35808)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oXuxL-0001ph-NQ
 for 57693 <at> debbugs.gnu.org; Mon, 12 Sep 2022 21:43:21 -0400
Received: by mail-pl1-f175.google.com with SMTP id t3so10317065ply.2
 for <57693 <at> debbugs.gnu.org>; Mon, 12 Sep 2022 18:43:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:from:to:cc:subject:date;
 bh=CFZO+cUWHAyOYkiyy+Gf2muhXNNe5dTrfbA4s07SsU4=;
 b=ESZaMlEcIYKIk7CyvQtVe4KK66ju4o/3DxinLk85Zz/7spmBtuDcm1rTCv/1dadU/T
 mpwOoTNdo8G0xPRLDewYUjo3AhfaYUCGsE2Z0mqy1zXUirIWWzRN1a55tv159krcognU
 QZvlQkk/1NwX5fBfo7WvDlpN0xm32XIixr85doOqRd8goNHpSH/EMn7J5JltQ/HEgFYg
 hEf79sQ1OMLGbMcVVN3mdnrZ8WbeQ2Z6oFJCc1e5dLfgFugwIYvGalZhdV7F8iUTSF9j
 eMJdfALwfGcI1f9FKPp8nYF5iodsephc/SPFGuwNAJOnFl3hBHU0ZUkvTDxkhyjgCFFR
 kCjA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:x-gm-message-state:from:to:cc:subject:date;
 bh=CFZO+cUWHAyOYkiyy+Gf2muhXNNe5dTrfbA4s07SsU4=;
 b=hb8QhaCPdGGPgpN0DvUudTbpKNrKSSTDLca6YWiUMc0lTAt+smssrF/AVjN2V+dbOj
 NPf0t2lwNk7ZOa4TBaKCTp81DxExhzq5QcPg1v7rlx/zOQP7Zx3qEGAFMoq2FhcsPp9o
 qrMvl9jnRxVAvRSzqtzX6/1tWIKjFzvqdqlmrH8/ZvjTBAOqxxJlvPxz8bahr5TtyIK9
 izqGbauHiqBQnr92sxH5mec9i0usV9QibkYxdVMX1vY+x7KIU+En776zRCObW8HeUUrQ
 OWJmxynXpN6JnE2CwMpPprJ/W/YhLUZEeJg/QIxZuxqCwz2/eo1mrcnqLJicM/nCblpw
 RImg==
X-Gm-Message-State: ACgBeo3JLs6L0vuIqkzNWkO+okv18N/Bc9kfdHJg7g8UrqdO0oKj1oUO
 Y1xusMKfO8YnT+Z1MLWImwM=
X-Google-Smtp-Source: AA6agR69xCOgL0ajdY8cVNbO4JE/H9RN36Jdj48Iztao9XV36Amc/LkDMKW3Tbasv95f8aarvjIM6g==
X-Received: by 2002:a17:90b:4fc8:b0:202:a340:3594 with SMTP id
 qa8-20020a17090b4fc800b00202a3403594mr1379899pjb.149.1663033393855; 
 Mon, 12 Sep 2022 18:43:13 -0700 (PDT)
Received: from localhost ([2409:8970:a81:48f7:8ec6:81ff:fe70:339d])
 by smtp.gmail.com with ESMTPSA id
 p9-20020a170902a40900b00176953f7997sm6737560plq.158.2022.09.12.18.43.11
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 12 Sep 2022 18:43:13 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
In-Reply-To: <83ills9741.fsf@HIDDEN>
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@HIDDEN>
 <87y1urybt6.fsf@localhost> <837d2bbr2s.fsf@HIDDEN>
 <87edwjy77h.fsf@localhost> <831qsjboy0.fsf@HIDDEN>
 <87v8puw945.fsf@localhost> <838rmq9rfr.fsf@HIDDEN>
 <837d2a9qcu.fsf@HIDDEN> <875yhtw3ed.fsf@localhost>
 <83ills9741.fsf@HIDDEN>
Date: Tue, 13 Sep 2022 09:44:06 +0800
Message-ID: <878rmoujyx.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

Eli Zaretskii <eliz@HIDDEN> writes:

> If the terminal's encoding is UTF-8, and it doesn't support the method
> we use to query about individual glyphs, char-displayable-p may return
> non-nil when the character cannot be displayed, i.e. will show as an
> empty box or something.  Otherwise, char-displayable-p does provide
> the correct answer for TTY frames.

Do I understand correctly that:
1. `font-at' is not sufficient for terminals, and we also need to use
   `char-displayable-p'
2. `char-displayable-p' works on many terminals but may be inaccurate in some

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 12 Sep 2022 11:15:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 12 07:15:33 2022
Received: from localhost ([127.0.0.1]:44321 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oXhPZ-0006NR-Ac
	for submit <at> debbugs.gnu.org; Mon, 12 Sep 2022 07:15:33 -0400
Received: from eggs.gnu.org ([209.51.188.92]:33516)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1oXhPW-00062m-TI
 for 57693 <at> debbugs.gnu.org; Mon, 12 Sep 2022 07:15:31 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:47432)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oXhPR-0007zo-0L; Mon, 12 Sep 2022 07:15:25 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=Fgp8LrhhMLbRK/2U4ppzZ+16jXDK1/CCC+Oc494uOAY=; b=jmnab1lYGNx6
 1jeeNvS/ehb41X5OrDexnwxP2N273Zrfho6z3Iz+xMkd1TgIgidqyfQzcUY8qW1ts6D56aEXQbDSI
 QTzO0eSeVCrBUzfyYlnpkYtaqIoIQydIPRAG76MzhgqPv8NpU1/gzEfm1G/tRSxFjarZ3RYfjA0/p
 SB625aRFk+wW+0nMKZtlzcL+iWTc8MD3LZ6NnalYdHsgxAgcTRW0NqaW4SvskTd9oNq4ZgGfhJZS7
 WZULkQHe1aN9aKBVooX2hZ+y9/xcCE+fY6WQ8Uy6k5847JEbixkRpFuhPvNzNqir7blHlmE9tVchB
 ZDwvJ2Xf5XnTnOxWCCscng==;
Received: from [87.69.77.57] (port=2440 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oXhPQ-0004zo-FW; Mon, 12 Sep 2022 07:15:24 -0400
Date: Mon, 12 Sep 2022 14:15:10 +0300
Message-Id: <83ills9741.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
In-Reply-To: <875yhtw3ed.fsf@localhost> (message from Ihor Radchenko on Mon,
 12 Sep 2022 13:46:50 +0800)
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@HIDDEN>
 <87y1urybt6.fsf@localhost> <837d2bbr2s.fsf@HIDDEN>
 <87edwjy77h.fsf@localhost> <831qsjboy0.fsf@HIDDEN>
 <87v8puw945.fsf@localhost> <838rmq9rfr.fsf@HIDDEN>
 <837d2a9qcu.fsf@HIDDEN> <875yhtw3ed.fsf@localhost>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Ihor Radchenko <yantar92@HIDDEN>
> Cc: 57693 <at> debbugs.gnu.org
> Date: Mon, 12 Sep 2022 13:46:50 +0800
> 
> > Do you need this to work for TTY frames as well?  If so, it could be a
> > problem, since most terminal emulators don't provide a way of
> > inquiring whether a certain character can be displayed.
> > char-displayable-p currently just checks on most terminals that the
> > terminal-coding-system can _encode_ the character, which isn't enough
> > if the terminal encoding is UTF-8.
> 
> The original code I was referring to unconditionally used a "safe"
> fallback on terminals. If there is no technical possibility to determine
> whether a character can be displayed, so be it.

If the terminal's encoding is UTF-8, and it doesn't support the method
we use to query about individual glyphs, char-displayable-p may return
non-nil when the character cannot be displayed, i.e. will show as an
empty box or something.  Otherwise, char-displayable-p does provide
the correct answer for TTY frames.

> I am thinking about something like below (to insert string, not a char),

LGTM.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 12 Sep 2022 05:46:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 12 01:46:07 2022
Received: from localhost ([127.0.0.1]:43869 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oXcGk-0004HS-Sb
	for submit <at> debbugs.gnu.org; Mon, 12 Sep 2022 01:46:07 -0400
Received: from mail-pg1-f172.google.com ([209.85.215.172]:38849)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oXcGg-0004Gg-VC
 for 57693 <at> debbugs.gnu.org; Mon, 12 Sep 2022 01:46:05 -0400
Received: by mail-pg1-f172.google.com with SMTP id t70so7272592pgc.5
 for <57693 <at> debbugs.gnu.org>; Sun, 11 Sep 2022 22:46:02 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:from:to:cc:subject:date;
 bh=lyrcnoOXyjLsqaFuUuKAqBaipfYa3jSAaoqrh56mF4Y=;
 b=WjShw++u24+o+3DcdcWd3nYy9XptRbbsl1Pohj779j1ub4QI01eBzuxeGxFCHNZjMi
 hxXlZpmAKH7fgwk9ZZ2LFhv+kyZNf3k+OUw4TGa4fe6prwKkGOOY12qdFuFYQE8jCm+6
 yTktPpNsmRLh9ntVCK3oKiAtBs/2H+LRwqxoag9vIj1UynWcYR63pLsrgFQsGXgqRu0g
 E1FEHDk0zEtsLYcDceOZQqW4DJyHJ7jdltSQ0Ek5Y6L5emBBVKcrBZKU5tcNJm8SNnRB
 QCQ6d8lyoL1rDrCWHXragOdWhyarxgP0qr6kLIzc1RMGeAxSEi7mQFTNwMWk6jqus5+8
 7ggw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:x-gm-message-state:from:to:cc:subject:date;
 bh=lyrcnoOXyjLsqaFuUuKAqBaipfYa3jSAaoqrh56mF4Y=;
 b=r2Nj2VMUynuIsakonkqzjOCP+Rn+KT4H83/4P2T//t2Ipv/Cx9mEzbB0NncWZrBx/+
 51LvEoMKxZqHqPTFhlBK+Bd54bwtuH0YMK2tjiVs6p3lbW0hg7UOtebSZa5AievADE+N
 k1wd4U7q4dTOdvBS8dyhDr/YDsywmy+jQtaU9n3po/u/PLe0aoJ52CDrTmvo6pIOybPe
 No9BM/J1D1Px75VSO5dL01JwCnFO4GfOJJZYOybLFvtRz/f4Zid1roym9G6EhcNlxO3T
 J+H8EyQmgYJCJq/qOEB34mAc+P17tttptT49bwAKVLcWm/ZhxpKC9z3jeyrwCYuJHeWS
 FFKA==
X-Gm-Message-State: ACgBeo2sJNeIaYtp0WC2+kvx69lKdE4ysArvm6cUzUaEmxuu1Qe5hIZ5
 zdqT+Bjal3votz9THJMICYMtGVIl86Y=
X-Google-Smtp-Source: AA6agR5ugVhzeNt5+ELNLUQByKOev6QBKD3aAo9YH739UpD8qDKeYY66NL6w4JV0EfQ9xzfgCmvVmg==
X-Received: by 2002:a65:6e83:0:b0:42a:868b:dc89 with SMTP id
 bm3-20020a656e83000000b0042a868bdc89mr22180004pgb.554.1662961556777; 
 Sun, 11 Sep 2022 22:45:56 -0700 (PDT)
Received: from localhost ([2409:8a70:2bc:c850:8ec6:81ff:fe70:339d])
 by smtp.gmail.com with ESMTPSA id
 jm15-20020a17090304cf00b00177ff4019d9sm4853603plb.274.2022.09.11.22.45.55
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 11 Sep 2022 22:45:56 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
In-Reply-To: <837d2a9qcu.fsf@HIDDEN>
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@HIDDEN>
 <87y1urybt6.fsf@localhost> <837d2bbr2s.fsf@HIDDEN>
 <87edwjy77h.fsf@localhost> <831qsjboy0.fsf@HIDDEN>
 <87v8puw945.fsf@localhost> <838rmq9rfr.fsf@HIDDEN>
 <837d2a9qcu.fsf@HIDDEN>
Date: Mon, 12 Sep 2022 13:46:50 +0800
Message-ID: <875yhtw3ed.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

Eli Zaretskii <eliz@HIDDEN> writes:

> Here's what I suggest for GUI frames:
>
>   (defun insert-char-safely (ch repl)
>     "Insert character CH, if it can be displayed; otherwise insert REPL."
>     (insert ch)
>     (unless (font-at (1- (point)))
>       (delete-char -1)
>       (insert repl)))

Thanks!

> Do you need this to work for TTY frames as well?  If so, it could be a
> problem, since most terminal emulators don't provide a way of
> inquiring whether a certain character can be displayed.
> char-displayable-p currently just checks on most terminals that the
> terminal-coding-system can _encode_ the character, which isn't enough
> if the terminal encoding is UTF-8.

The original code I was referring to unconditionally used a "safe"
fallback on terminals. If there is no technical possibility to determine
whether a character can be displayed, so be it.

I am thinking about something like below (to insert string, not a char),

(defun org-insert-displayable (&rest strings)
  "Insert the first displayable string from STRINGS.
If none of the STRINGS can be displayed, display the last string.
In terminal, always insert the last string."
  (if (not (display-graphic-p))
      (insert (car (last strings)))
    (catch :displayable
      (dolist (string strings)
	(insert string)
        (save-excursion
          (catch :undisplayable
            (dotimes (i (length string))
              (unless (font-at (- (point) i 1))
		(throw :undisplayable t)))
            ;; All chars can be displayed. Keep the inserted string.
            (throw :displayable t)))
        ;; Some char cannot be displayed. Clear the insertion and move ahead to
        ;; the next candidate.
        (delete-char (- (length string))))
      ;; None displayable.
      (insert (car (last strings))))))

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 12 Sep 2022 05:23:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 12 01:23:42 2022
Received: from localhost ([127.0.0.1]:43856 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oXbv4-0003eK-89
	for submit <at> debbugs.gnu.org; Mon, 12 Sep 2022 01:23:42 -0400
Received: from mail-pg1-f179.google.com ([209.85.215.179]:40878)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oXbv1-0003e6-Tj
 for 57693 <at> debbugs.gnu.org; Mon, 12 Sep 2022 01:23:40 -0400
Received: by mail-pg1-f179.google.com with SMTP id r17so7223132pgr.7
 for <57693 <at> debbugs.gnu.org>; Sun, 11 Sep 2022 22:23:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:from:to:cc:subject:date;
 bh=mtNSVgFjs5vvkceQkom/PgkibGMbB3n1eU05zc1uSkI=;
 b=W1KyVqsjrijhcianm50Z/59Lbdhx+2+LpJYooHcm0QRQtXuuRW/PH0EYJBE5XVmu1k
 5gQ2DmBBP6SDzwAXBbIQeA0TC3M19xEBESV57yMcxklvccWnYzcdv+cpALnOwWlLuhmo
 XY39dTL8+3fwx7hE67uTYo/tyWJSNDBcog3qDX1BuvkVxWKYRcDEStuqGvrkfssJtxSV
 TytOMKSfyl0U/Vv0fY+KSGEG2yEtjzFv2M3d4tA+ibYqLQaH8vmuCnP4LPnVaVyRC6Ce
 dEP+ULJe5yK9FJQmf/9Nhf5oM3hcXAu5K4OF8IysPmnvsSuCAbkhK5ddVmPO7TRSlyMd
 hC0g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:x-gm-message-state:from:to:cc:subject:date;
 bh=mtNSVgFjs5vvkceQkom/PgkibGMbB3n1eU05zc1uSkI=;
 b=iQl5hhN+ASxmwk6/fcwKuFAvLf1dER994kfGKUXPv1VcnBqy8R/98GBjvycXHmVS9t
 oU4Tlt0sZHLkgoru/IbkjD9PhGlqErasaG+GxOOmLkUJ7ZaUVKgXPAer5FrE0X/EORQU
 UUUaAaaj4m8c41U+VeNYLCfXUl1ZVUEHiEcWGxhJ1VZz6szIGHLHMPjNRuS0vPbVgx8F
 i6Fi4GLHXvxwOudv92aRZ0V1fT6pFH5H01GUHuyS0E/VPKRkZCyBmSYk93d3VihEESOB
 82RY5B/sgPTx0MPqtldjCXFNIKAutxGWwvfo7UTZpTbm1pUlaGh/mzyMMqE9aD3wg25R
 qTkA==
X-Gm-Message-State: ACgBeo0rjeZH3xjx9JrwtUJ1vMZm8ODM0pnCa8GZUtNtSdOQAiDMyqU9
 Dy/CarEhI/3VDRI69eSToEhn25YMMOc=
X-Google-Smtp-Source: AA6agR6IAvxzuPmMfA9NPpjBoE+O4zgAuq3q5hOm499JYLUgAhevv7xD3sLx1+Kxtnza2tk5zVZLaA==
X-Received: by 2002:a65:6e82:0:b0:41a:9b73:f0e6 with SMTP id
 bm2-20020a656e82000000b0041a9b73f0e6mr22682995pgb.371.1662960214002; 
 Sun, 11 Sep 2022 22:23:34 -0700 (PDT)
Received: from localhost ([2409:8a70:2bc:c850:8ec6:81ff:fe70:339d])
 by smtp.gmail.com with ESMTPSA id
 d82-20020a621d55000000b005383988ec0fsm4253887pfd.162.2022.09.11.22.23.32
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 11 Sep 2022 22:23:33 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
In-Reply-To: <838rmq9rfr.fsf@HIDDEN>
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@HIDDEN>
 <87y1urybt6.fsf@localhost> <837d2bbr2s.fsf@HIDDEN>
 <87edwjy77h.fsf@localhost> <831qsjboy0.fsf@HIDDEN>
 <87v8puw945.fsf@localhost> <838rmq9rfr.fsf@HIDDEN>
Date: Mon, 12 Sep 2022 13:24:27 +0800
Message-ID: <878rmpw4fo.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

Eli Zaretskii <eliz@HIDDEN> writes:

>> > The display engine only knows it retroactively, when it tried and
>> > failed to display a character.
>> 
>> The situation is similar to `string-pixel-width'.
>
> ??? You rejected such methods in an earlier message, because it
> required a temporary buffer, which you said will not reproduce the
> exact environment of the buffer where you want to show the character.
> Or what am I missing?

Sorry for not being clear.

I was referring to the approach when we try to insert a text into buffer
(temporary or not) and then check the result in some way.

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 11 Sep 2022 10:07:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 11 06:07:40 2022
Received: from localhost ([127.0.0.1]:40759 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oXJsJ-0007JL-K7
	for submit <at> debbugs.gnu.org; Sun, 11 Sep 2022 06:07:39 -0400
Received: from eggs.gnu.org ([209.51.188.92]:33326)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1oXJsH-0007J9-Uz
 for 57693 <at> debbugs.gnu.org; Sun, 11 Sep 2022 06:07:38 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:46838)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oXJsB-0006tS-Cd; Sun, 11 Sep 2022 06:07:32 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=AN6Wv1soFvqcRT2PvRBpBNdl7m9bm6NbHZr3Q/m/b4o=; b=dcqyMnU5SWWG
 1ZvPJ4DBGW87r/Ut6Uiljdrazm1ugOSIjSoXUl4mLN1JbKa7chPLTxXfndLFD6t45d6Y6Lnn+fcvS
 EkaHcct6Bz0n1Unn6pShoB2rBVr/ybZvwI0hi4b4ydTRhGhw47dHL/z/amO+Npd1dwZcoYDFN3ofL
 w/k1XIMBsa6ihon+zSDDeTiW9zeQzwe6S7dbUezN+QtZUQiCpbqmSFGQdmjglRz1yvEhBCiCZUPZg
 y9Hfs/T9xDwQBPhmuirhnHA7XPnqfKgZlQy8ZYpJuFazrHlAFi+Kz6qIFEWHd2MyZUJCttA1HwMZz
 ReBsvAYrl2QNxUJoQdH09w==;
Received: from [87.69.77.57] (port=1898 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oXJsA-0004No-SW; Sun, 11 Sep 2022 06:07:31 -0400
Date: Sun, 11 Sep 2022 13:07:13 +0300
Message-Id: <837d2a9qcu.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: yantar92@HIDDEN
In-Reply-To: <838rmq9rfr.fsf@HIDDEN> (message from Eli Zaretskii on Sun, 11
 Sep 2022 12:43:52 +0300)
Subject: Re: bug#57693: 29.0.50;
 Is there a more reliable version of `char-displayable-p'?
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@HIDDEN>
 <87y1urybt6.fsf@localhost> <837d2bbr2s.fsf@HIDDEN>
 <87edwjy77h.fsf@localhost> <831qsjboy0.fsf@HIDDEN> <87v8puw945.fsf@localhost>
 <838rmq9rfr.fsf@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Cc: 57693 <at> debbugs.gnu.org
> Date: Sun, 11 Sep 2022 12:43:52 +0300
> From: Eli Zaretskii <eliz@HIDDEN>
> 
> > From: Ihor Radchenko <yantar92@HIDDEN>
> > Cc: 57693 <at> debbugs.gnu.org
> > Date: Sun, 11 Sep 2022 17:31:06 +0800
> > 
> > >   insert the character
> > >   call the new magic
> > >   if the new magic says NO-CAN-DO
> > >      replace the character with something else
> > >
> > > If the above is acceptable, I think it can be done, although it would
> > > not be very useful in other situations.  But if you want to know the
> > > answer before you insert the character, I don't think we know how to
> > > satisfy your requirements with 100% accuracy.  At least I cannot see
> > > how it could be done; maybe someone else will.
> > 
> > The described approach should be acceptable.
> > What I have in mind is a function like
> > 
> >   (insert-displayable '("fancy version" "backup"))
> > 
> > The function will try to insert "fancy version" first; check if all the
> > characters are displayable, and replace the inserted text with "backup"
> > if not.
> 
> OK, I will see what I can do.

Here's what I suggest for GUI frames:

  (defun insert-char-safely (ch repl)
    "Insert character CH, if it can be displayed; otherwise insert REPL."
    (insert ch)
    (unless (font-at (1- (point)))
      (delete-char -1)
      (insert repl)))

Do you need this to work for TTY frames as well?  If so, it could be a
problem, since most terminal emulators don't provide a way of
inquiring whether a certain character can be displayed.
char-displayable-p currently just checks on most terminals that the
terminal-coding-system can _encode_ the character, which isn't enough
if the terminal encoding is UTF-8.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 11 Sep 2022 09:44:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 11 05:44:19 2022
Received: from localhost ([127.0.0.1]:40744 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oXJVj-0006iT-9N
	for submit <at> debbugs.gnu.org; Sun, 11 Sep 2022 05:44:19 -0400
Received: from eggs.gnu.org ([209.51.188.92]:48452)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1oXJVh-0006iC-7s
 for 57693 <at> debbugs.gnu.org; Sun, 11 Sep 2022 05:44:18 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:52796)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oXJVc-0003gN-1R; Sun, 11 Sep 2022 05:44:12 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=biFUBkQDrcBZpgGYiDnLT9Vn9whHa0SMBxwzhoV02fM=; b=TdSMoAZb0EdF
 zEnDpe5aXz0bdANfGfWuhQ2HYbeiCbXNSSIgNayqSsAK29dO6v09O2gdVurcqaoLKPVr59xiqBZDk
 ApqE5QyKNRQ6M3iteur9R7KP1H3mu3195tjhv0yHBf8S6Ppi/adi2998XTvzjL7m9nLtFaxji7VsX
 KzHTOGX9RC2b5/NpwbJ1n8kC7kVgln/4huZs8wIhL6m9NacddHmOl878Iq64t9dc117pitzvs3r/w
 snuSEeIweGoIHjmVi7TLrsVTypOoCnbMMXBOAwnn6z0knEh64l72125dNn5jZHnRKhfDMhPPMSQcZ
 5nfCsKaNRnRWPJ8KF8LlbA==;
Received: from [87.69.77.57] (port=4452 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oXJVa-0005K9-RL; Sun, 11 Sep 2022 05:44:11 -0400
Date: Sun, 11 Sep 2022 12:43:52 +0300
Message-Id: <838rmq9rfr.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
In-Reply-To: <87v8puw945.fsf@localhost> (message from Ihor Radchenko on Sun,
 11 Sep 2022 17:31:06 +0800)
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@HIDDEN>
 <87y1urybt6.fsf@localhost> <837d2bbr2s.fsf@HIDDEN>
 <87edwjy77h.fsf@localhost> <831qsjboy0.fsf@HIDDEN> <87v8puw945.fsf@localhost>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Ihor Radchenko <yantar92@HIDDEN>
> Cc: 57693 <at> debbugs.gnu.org
> Date: Sun, 11 Sep 2022 17:31:06 +0800
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> >> Yup. And I am asking if there is such test exposed to Elisp. Display
> >> code certainly knows when some character cannot be displayed and must be
> >> replaced by its hex code.
> >
> > The display engine only knows it retroactively, when it tried and
> > failed to display a character.
> 
> The situation is similar to `string-pixel-width'.

??? You rejected such methods in an earlier message, because it
required a temporary buffer, which you said will not reproduce the
exact environment of the buffer where you want to show the character.
Or what am I missing?

> >   insert the character
> >   call the new magic
> >   if the new magic says NO-CAN-DO
> >      replace the character with something else
> >
> > If the above is acceptable, I think it can be done, although it would
> > not be very useful in other situations.  But if you want to know the
> > answer before you insert the character, I don't think we know how to
> > satisfy your requirements with 100% accuracy.  At least I cannot see
> > how it could be done; maybe someone else will.
> 
> The described approach should be acceptable.
> What I have in mind is a function like
> 
>   (insert-displayable '("fancy version" "backup"))
> 
> The function will try to insert "fancy version" first; check if all the
> characters are displayable, and replace the inserted text with "backup"
> if not.

OK, I will see what I can do.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 11 Sep 2022 09:30:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 11 05:30:24 2022
Received: from localhost ([127.0.0.1]:40727 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oXJIE-0006OW-V2
	for submit <at> debbugs.gnu.org; Sun, 11 Sep 2022 05:30:23 -0400
Received: from mail-pl1-f177.google.com ([209.85.214.177]:35581)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oXJIA-0006O9-3M
 for 57693 <at> debbugs.gnu.org; Sun, 11 Sep 2022 05:30:22 -0400
Received: by mail-pl1-f177.google.com with SMTP id t3so5861181ply.2
 for <57693 <at> debbugs.gnu.org>; Sun, 11 Sep 2022 02:30:18 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:from:to:cc:subject:date;
 bh=nPCmsg3tZEEjYk6rlPD+Pj/58bmmmbx1eUBrnGZZllA=;
 b=XmgDNQcNbCEsI/jMy+9kwhAJ3XyR16uKr0wgbNzJRiVZ3wtlfaeLTB6d6SPz7aRHRa
 Ke+wNXJRSpb1GmuB2JFBrNjT1iPg6rOCHjnw/y/txBhpO5im23cZWJmIMnkOc/fgy9ab
 tdRVnxQ6XOKrJi6ae3CIm5MgAcGAfPfwTVgIeCP4QGA5ryLy7T5asrz2XuVW16qIhIYG
 7/5Jxoxd5R2r79Vwk9HfySvK6d26h65bgFQqAYOYFSf7recoDc3UvUw3khXgbhd+aoFF
 9udo6y4/cM/Rbth0P0/jBbK+Us2E4lo5RWFZaWqSVQzx3+XrrlgsFk5lfmxpiNmscNLQ
 aLyQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:x-gm-message-state:from:to:cc:subject:date;
 bh=nPCmsg3tZEEjYk6rlPD+Pj/58bmmmbx1eUBrnGZZllA=;
 b=mnjnyx+FNQP28kjA34mOJ1pTc/Pt4o58d+KaaZiiqdYgvb7XuYa6k6Ao1HitTvCc8/
 +FduHZEQI2kAChhhfFhvIPdD646XyKsPpW4GpMhHuV/onCo/VJ7PhA88pPkJgu1a3bv3
 nGOnT/uCu3ft02q3OELIApjhAaVCeH/nzMABWVFcFxw87WG5Y1XyqY4KyjkCO/oBC4yD
 RDKktWEu/hWTil0Mkch5Oq2TTlTC72nmu3bc3Anzg9IXsD/6HQxPA7ApixvCDQhneINm
 NYhbD3MzB1sN2JB+Usj44vjT7jQnitoMYSWkVwbvMJFNn/Lcz+HngnelZlGlwde8bFJH
 +W4Q==
X-Gm-Message-State: ACgBeo0Rlvz6F6MADoGE2i9ycGXeoI9IhhKcQWoIJZ8PKdWxclfVfdXL
 lC1F+fgh6/U8aKD1ow9QT1aYSnKU6aA=
X-Google-Smtp-Source: AA6agR59eOI644bPkoTxJfcEQtnvsTDE5gUyMlr+gwXg/b5JIuizCPAeO7C4DZGgP8+RneSi2CMGqw==
X-Received: by 2002:a17:90b:1e0d:b0:202:91ec:e167 with SMTP id
 pg13-20020a17090b1e0d00b0020291ece167mr10430403pjb.174.1662888612130; 
 Sun, 11 Sep 2022 02:30:12 -0700 (PDT)
Received: from localhost ([2409:8a70:2bc:c850:8ec6:81ff:fe70:339d])
 by smtp.gmail.com with ESMTPSA id
 w2-20020a1709026f0200b00172ba718ed4sm3565258plk.138.2022.09.11.02.30.10
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 11 Sep 2022 02:30:11 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
In-Reply-To: <831qsjboy0.fsf@HIDDEN>
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@HIDDEN>
 <87y1urybt6.fsf@localhost> <837d2bbr2s.fsf@HIDDEN>
 <87edwjy77h.fsf@localhost> <831qsjboy0.fsf@HIDDEN>
Date: Sun, 11 Sep 2022 17:31:06 +0800
Message-ID: <87v8puw945.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

Eli Zaretskii <eliz@HIDDEN> writes:

>> Yup. And I am asking if there is such test exposed to Elisp. Display
>> code certainly knows when some character cannot be displayed and must be
>> replaced by its hex code.
>
> The display engine only knows it retroactively, when it tried and
> failed to display a character.

The situation is similar to `string-pixel-width'.
Trying to display and checking retroactively should be a valid option,
unless I miss something.

>> This is not great. I am really hoping that we can make nicer defaults
>> when possible and only fallback to something robust when fancy version
>> cannot be used.
>
> I'm not sure I understand how this could be done even in principle.
> The conditions and restrictions you put forward can only be tested by
> trying to display the character at its specific place in a specific
> buffer and a specific window (because all of those can potentially
> affect the face and thus the font).  We can code a function that
> emulates the display, but such a function can only work if the
> offending character was already inserted into its place and is part of
> buffer text.  Is this something you'd consider good enough, to have to
> do something like
>
>   insert the character
>   call the new magic
>   if the new magic says NO-CAN-DO
>      replace the character with something else
>
> If the above is acceptable, I think it can be done, although it would
> not be very useful in other situations.  But if you want to know the
> answer before you insert the character, I don't think we know how to
> satisfy your requirements with 100% accuracy.  At least I cannot see
> how it could be done; maybe someone else will.

The described approach should be acceptable.
What I have in mind is a function like

  (insert-displayable '("fancy version" "backup"))

The function will try to insert "fancy version" first; check if all the
characters are displayable, and replace the inserted text with "backup"
if not.

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 10 Sep 2022 08:42:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 10 04:42:59 2022
Received: from localhost ([127.0.0.1]:36552 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oWw4o-0004MN-P8
	for submit <at> debbugs.gnu.org; Sat, 10 Sep 2022 04:42:59 -0400
Received: from eggs.gnu.org ([209.51.188.92]:43512)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1oWw4n-0004MB-Ca
 for 57693 <at> debbugs.gnu.org; Sat, 10 Sep 2022 04:42:57 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:54546)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oWw4i-0006nx-5m; Sat, 10 Sep 2022 04:42:52 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=Zv3n2ISNWLzW2FU6AbmPWuX5BK9IDD35gt2yrK/W0lA=; b=HVGRPAr4ywsm
 LCL2tK68ts4O0N6dQ8IOtgNXTIL+wTB1RYkUPi40G5oD5xjfOOSVxyACFRxJbQ1IYqO/2lVDT38sk
 4PSMhnPyNunxo9gbW307HoYO3xvCxGjC7F7OxNgsF4K7ceAuG59Khw1okzlKjLf9/rxsIZd5+TC0u
 Hw79s69WS7APcVlRNcSdkalv5039P+hkdH7vud1Es/2BmDX1I6A0S5GENzh8Xq+EMMtVQoeb2GPoz
 ceIWO9m66x3vXUncq/Q/psiaznIzNpdEq7BT1gKh4dx1188+I4IHP3U/yVZr3mB/Y/sAJeWuKlSfP
 aKzF/t8OlsQkIGIa361x/g==;
Received: from [87.69.77.57] (port=3526 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oWw4h-0000yq-L1; Sat, 10 Sep 2022 04:42:51 -0400
Date: Sat, 10 Sep 2022 11:42:31 +0300
Message-Id: <831qsjboy0.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
In-Reply-To: <87edwjy77h.fsf@localhost> (message from Ihor Radchenko on Sat,
 10 Sep 2022 16:17:06 +0800)
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@HIDDEN>
 <87y1urybt6.fsf@localhost> <837d2bbr2s.fsf@HIDDEN> <87edwjy77h.fsf@localhost>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Ihor Radchenko <yantar92@HIDDEN>
> Cc: 57693 <at> debbugs.gnu.org
> Date: Sat, 10 Sep 2022 16:17:06 +0800
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> >> This should indeed be slightly more accurate. However, it will still not
> >> cover scenarios when, for example, an overlay at point has 'face
> >> property that sets a font that is unable to display given char. Or do I
> >> miss something?
> >
> > Or what if the character has a display-table entry that calls for
> > displaying a different codepoint?
> >
> > Such situations would require a very different test to be 100%
> > accurate.
> 
> Yup. And I am asking if there is such test exposed to Elisp. Display
> code certainly knows when some character cannot be displayed and must be
> replaced by its hex code.

The display engine only knows it retroactively, when it tried and
failed to display a character.

> > For that reason, my suggestion would be to have the defcustom by
> > default specify some safe value, and leave it to users to customize it
> > to more fancy characters if they know it works in their
> > configurations.  Or just document that the default value may not
> > produce the expected display in some rare situations, i.e. leave it to
> > the users in such rare situations to customize back to a safe value.
> 
> This is not great. I am really hoping that we can make nicer defaults
> when possible and only fallback to something robust when fancy version
> cannot be used.

I'm not sure I understand how this could be done even in principle.
The conditions and restrictions you put forward can only be tested by
trying to display the character at its specific place in a specific
buffer and a specific window (because all of those can potentially
affect the face and thus the font).  We can code a function that
emulates the display, but such a function can only work if the
offending character was already inserted into its place and is part of
buffer text.  Is this something you'd consider good enough, to have to
do something like

  insert the character
  call the new magic
  if the new magic says NO-CAN-DO
     replace the character with something else

If the above is acceptable, I think it can be done, although it would
not be very useful in other situations.  But if you want to know the
answer before you insert the character, I don't think we know how to
satisfy your requirements with 100% accuracy.  At least I cannot see
how it could be done; maybe someone else will.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 10 Sep 2022 08:16:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 10 04:16:23 2022
Received: from localhost ([127.0.0.1]:36541 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oWvf4-0003j1-Uf
	for submit <at> debbugs.gnu.org; Sat, 10 Sep 2022 04:16:23 -0400
Received: from mail-pg1-f172.google.com ([209.85.215.172]:38667)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oWvf0-0003in-Ps
 for 57693 <at> debbugs.gnu.org; Sat, 10 Sep 2022 04:16:21 -0400
Received: by mail-pg1-f172.google.com with SMTP id t70so3632419pgc.5
 for <57693 <at> debbugs.gnu.org>; Sat, 10 Sep 2022 01:16:18 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:from:to:cc:subject:date;
 bh=HQGOQ+bM/XUbA2XnYl3qYSEGa8KGWSeoIYzbTbPkCWk=;
 b=GdNbvvAJBEIhWMZVDueLfhqH4pANlDiEcialCwddMk8dRRNjicw9froPQ+cJV9KRzh
 3QyfzxZa3jN5bE4CbOva6riFCEsImP5OUZU6K9AuQiowvi5AxGnP/JsL6UIfwW4v+p/J
 /XOuKiRrIj9W0LynpEPMw5rCm2wqd/jG1EU0NlFcOSRTxvJ/xTOux4pi+EtG1U7jW2Lo
 rYMJjHy00mAxYoBzNRHzI3RjfURKJyqXdMNvNB2Fmio7nbLOSITmbvZtetez0tLXtOsm
 RpcH9OhW2pOlkzTVPJFEpukLbJzKrfxVh1+CUnheEJLwElh2wCwcsEcT9QL89q5lxDp+
 MJaQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:x-gm-message-state:from:to:cc:subject:date;
 bh=HQGOQ+bM/XUbA2XnYl3qYSEGa8KGWSeoIYzbTbPkCWk=;
 b=TZWVil6TMQdueMeHMN5npbK1of9s4UMVLui3xHRp/b99Zo/yd9bM38r3HJi8KeFceQ
 8IVk8myqhin7pwg8rbB4SeqG/d+MCanAfgvxtUp8MI6zkFyzw7uyp/KSlt2zrC8xfCP0
 3Dv51ETwawyB0xtUE4cx+BHaz/JbspeDuLwfrd9DzIBC1PHOyuqs+hszCLGJwFtZ+o0f
 pCS0lPSLYXo6jEQPL2Znd4UIgEGfsBeKPsG5Q3whKfcSjRcfkXylEbOTc52wsG6/K8Dv
 V005UzN4dIUbze5GG8YNyqsCADrPCZoK1KqnmfUXbxV1bye10xCaGxEMvLrcYWwiLLl9
 qk7A==
X-Gm-Message-State: ACgBeo0Lblf/Dwtm+0uD13oESp3uvnMCt+3LOndFuOCCzOPS7H8YeqX3
 7cl/6D4mIEbfXRsO0JrPfgPcPP1GjZdIoQ==
X-Google-Smtp-Source: AA6agR6mfJS2UX3fADDEWauVxZ89Rbo0jF9o0zZJhPP9jU+b8b8kwbXM1//WiYkn/IjOyK/mpioOBw==
X-Received: by 2002:aa7:9d9a:0:b0:53e:8bc5:afb7 with SMTP id
 f26-20020aa79d9a000000b0053e8bc5afb7mr15562656pfq.54.1662797772855; 
 Sat, 10 Sep 2022 01:16:12 -0700 (PDT)
Received: from localhost ([1.83.154.15]) by smtp.gmail.com with ESMTPSA id
 d8-20020a17090a6a4800b001fd7e56da4csm1539683pjm.39.2022.09.10.01.16.11
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 10 Sep 2022 01:16:12 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
In-Reply-To: <837d2bbr2s.fsf@HIDDEN>
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@HIDDEN>
 <87y1urybt6.fsf@localhost> <837d2bbr2s.fsf@HIDDEN>
Date: Sat, 10 Sep 2022 16:17:06 +0800
Message-ID: <87edwjy77h.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

Eli Zaretskii <eliz@HIDDEN> writes:

>> This should indeed be slightly more accurate. However, it will still not
>> cover scenarios when, for example, an overlay at point has 'face
>> property that sets a font that is unable to display given char. Or do I
>> miss something?
>
> Or what if the character has a display-table entry that calls for
> displaying a different codepoint?
>
> Such situations would require a very different test to be 100%
> accurate.

Yup. And I am asking if there is such test exposed to Elisp. Display
code certainly knows when some character cannot be displayed and must be
replaced by its hex code.

> For that reason, my suggestion would be to have the defcustom by
> default specify some safe value, and leave it to users to customize it
> to more fancy characters if they know it works in their
> configurations.  Or just document that the default value may not
> produce the expected display in some rare situations, i.e. leave it to
> the users in such rare situations to customize back to a safe value.

This is not great. I am really hoping that we can make nicer defaults
when possible and only fallback to something robust when fancy version
cannot be used.

I was hoping that Org can do the following:
1. Allow org-agenda-current-time-string to be a list of ("fancy string"
 "fallback")
2. When actually inserting org-agenda-current-time-string to buffer,
test if "fancy string" can be displayed and if not insert the
"fallback".

The only question is how to test whether all the chars in the inserted
string are displayed.

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 10 Sep 2022 07:56:56 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 10 03:56:56 2022
Received: from localhost ([127.0.0.1]:36536 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oWvMF-0003FU-Uw
	for submit <at> debbugs.gnu.org; Sat, 10 Sep 2022 03:56:56 -0400
Received: from eggs.gnu.org ([209.51.188.92]:47712)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1oWvMD-0003FD-VC
 for 57693 <at> debbugs.gnu.org; Sat, 10 Sep 2022 03:56:54 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:37986)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oWvM8-0000WF-LP; Sat, 10 Sep 2022 03:56:48 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=uFhsHDTosVo6rklz7gHr9ppFrYCCVd83dnVNkoKA6w4=; b=orA9sFeP5JSZ
 NAnvhHBzZkBjFwrpMvWzd75E90UbiTFCgUIl+KVumMgn5Wl92PqbVoWX3eRqFKWhpv6E4talk2DZt
 N8cuz4SZBfPy4r6CQpiLcPNIxqSIVdPnxuGBWFI9twgg5l2acDe0W1kS2bV7Qi8wH/EFakHkYnw/B
 PRzYht2WoSj9L4QKDRG4KXdf1v/8Izu1sAHrgK5UMQJaDhE/mlFH/JnohknYxLBWlvwj+EpMB1CFH
 q/TZYBEK4AYuMtoyzs8VPCQh4xWUsBLKV8M0JQt0kcARHCRrVUuQP4UNH4OoJoBEili2Z5KZYLkX6
 5EYWsOIjFsOOcSTKWU/0Aw==;
Received: from [87.69.77.57] (port=4704 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oWvM6-0002g8-Oj; Sat, 10 Sep 2022 03:56:48 -0400
Date: Sat, 10 Sep 2022 10:56:27 +0300
Message-Id: <837d2bbr2s.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
In-Reply-To: <87y1urybt6.fsf@localhost> (message from Ihor Radchenko on Sat,
 10 Sep 2022 14:37:41 +0800)
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@HIDDEN> <87y1urybt6.fsf@localhost>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Ihor Radchenko <yantar92@HIDDEN>
> Cc: 57693 <at> debbugs.gnu.org
> Date: Sat, 10 Sep 2022 14:37:41 +0800
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> >> However, it is not very clear for me how to determine programmatically if
> >> given character is displayable in buffer.
> >
> > Make the char-displayable-p test at run time, I guess, i.e. when you
> > are actually about to insert it.
> 
> This should indeed be slightly more accurate. However, it will still not
> cover scenarios when, for example, an overlay at point has 'face
> property that sets a font that is unable to display given char. Or do I
> miss something?

Or what if the character has a display-table entry that calls for
displaying a different codepoint?

Such situations would require a very different test to be 100%
accurate.

For that reason, my suggestion would be to have the defcustom by
default specify some safe value, and leave it to users to customize it
to more fancy characters if they know it works in their
configurations.  Or just document that the default value may not
produce the expected display in some rare situations, i.e. leave it to
the users in such rare situations to customize back to a safe value.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 10 Sep 2022 06:43:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 10 02:43:26 2022
Received: from localhost ([127.0.0.1]:36422 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oWuD7-0001Fr-Tm
	for submit <at> debbugs.gnu.org; Sat, 10 Sep 2022 02:43:26 -0400
Received: from mail-pf1-f174.google.com ([209.85.210.174]:46035)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oWuD6-0001Ff-Dd
 for 57693 <at> debbugs.gnu.org; Sat, 10 Sep 2022 02:43:25 -0400
Received: by mail-pf1-f174.google.com with SMTP id z187so3629979pfb.12
 for <57693 <at> debbugs.gnu.org>; Fri, 09 Sep 2022 23:43:24 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:from:to:cc:subject:date;
 bh=7qU52GGH3Bc4CJ5+U2tjdmT4V/RnJs1ANpf74aGLXLU=;
 b=L2mViWWea+kiR9ukLu3TYs9GGJrCNY6Tvp+DfKDxbNEvOt9A4jEckPvZhcqLradV2F
 G5HdmcziyszEEo8lJz6LHbafnGQmmi4GpTl8eQIIrGidvp3T+ME1dgBkoNeVcOz6b6a/
 UcPEKN2OLhDctwGMu55B5rHxRkPUUvuRFKsgHpQlER/Wj/BHAMdJR1ZIzUlqIUGhs7ey
 8wVzGhyDcgus32aNjHspz/SlIEnYsP20e4yZpFCD15Rj9uXYcyCvzq7QPLFihOfSfwwJ
 Tw9AEYnT0GaMui/qxjmvXK7UAefaHxkDHto1H7JSLFysH1nAwcRpIZDwKhwJ+wS6Ja8c
 guMw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:x-gm-message-state:from:to:cc:subject:date;
 bh=7qU52GGH3Bc4CJ5+U2tjdmT4V/RnJs1ANpf74aGLXLU=;
 b=ULiOlU/tF3qkF9rAx/w77jX5lOUNrBMGQA88G6dMN3X2xooV5+HTWI9Uj854U+nwAi
 HCAqzbayaFjbiP1m7JLOrwciCqfX+s/U7svQf6UFFFzgEZhSx3s5Kdbu6sInkaGFKtRZ
 FUMcX3MsQQhkNmIG6/zNI50HufonC5hrC2rhCGgpun8eGeIbBUr3v4rBlw4LqsZNnQ2m
 Y9bqULyNHmzCBgD7qsKZEkYGW5wyhKB1n8sPgyb7GoNP0MD1SAGKqUl459MfdrjHLr4c
 PI+d1yuucsACvBIYDZdaeZLykkpEC/Bt3tTAnH8H3JJ1g0vcbqhtAoe6PNnsOhO67UEn
 HA/A==
X-Gm-Message-State: ACgBeo0xjzFh4LIOwsacPVdeGRPJzPkhGnF/OwM0RJLHEfoX4cmJbx35
 VbxyWgHkZ3EZGXyOeFrHc20=
X-Google-Smtp-Source: AA6agR4czOAdeCOcRBjJ3ISAKIPuEtMaVNc4mjLJ7U6OkOFPjz0uXRHT4Uef5sIwExeO3rm3+h21aQ==
X-Received: by 2002:a65:6b89:0:b0:41a:69b1:8674 with SMTP id
 d9-20020a656b89000000b0041a69b18674mr14946471pgw.417.1662792198584; 
 Fri, 09 Sep 2022 23:43:18 -0700 (PDT)
Received: from localhost ([1.83.154.15]) by smtp.gmail.com with ESMTPSA id
 h17-20020a056a00001100b0052d4b0d0c74sm893624pfk.70.2022.09.09.23.43.17
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 09 Sep 2022 23:43:18 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
In-Reply-To: <83a677buu1.fsf@HIDDEN>
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <CADwFkmm1_gYqjwyoL-EO8vqYfESq+AZOUVT5werh4ehNCCSfoQ@HIDDEN>
 <83k06bbweg.fsf@HIDDEN> <87a677zrtz.fsf@localhost>
 <83a677buu1.fsf@HIDDEN>
Date: Sat, 10 Sep 2022 14:44:12 +0800
Message-ID: <87tu5fybib.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 57693
Cc: stefankangas@HIDDEN, 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

Eli Zaretskii <eliz@HIDDEN> writes:

>> The author of the linked bug report solved the problem by installing
>> some extra font. So, it was likely not a question of buffer-specific
>> settings in that particular case.
>
> Does it mean we don't understand why there was a failure in that case?
> It is imperative that we do understand it, to see whether
> char-displayable-p could be improved not to fail in those cases.

Unfortunately, no further details have been given.
I explicitly asked to share more details, but the user was uninterested
to dig further. See https://list.orgmode.org/orgmode/233fa8fb-e2a3-a121-5d9e-56de9a7ebfc5@HIDDEN/

I am unable to reproduce the problem in my system. Maybe someone with
limited fontset can try to recreate the problem.

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 10 Sep 2022 06:37:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 10 02:37:02 2022
Received: from localhost ([127.0.0.1]:36410 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oWu6t-00015H-3k
	for submit <at> debbugs.gnu.org; Sat, 10 Sep 2022 02:37:02 -0400
Received: from mail-pj1-f53.google.com ([209.85.216.53]:42730)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oWu6n-000150-Hw
 for 57693 <at> debbugs.gnu.org; Sat, 10 Sep 2022 02:36:57 -0400
Received: by mail-pj1-f53.google.com with SMTP id
 q62-20020a17090a17c400b00202a3497516so1203111pja.1
 for <57693 <at> debbugs.gnu.org>; Fri, 09 Sep 2022 23:36:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:from:to:cc:subject:date;
 bh=IE659SrDcVzKxka62Svp9cdgvk0Rfr/Ob0PQCdtzRXE=;
 b=PFttgmGef7jn0jsawQunWyG3XyBgxw91rCa10SA2YP4Uan2io7izPfgxVJGM6RV8wT
 yZ66Va0KI2J/iIHBORk2A0SDMRY1f3FPyd2YPjS7V8WKWKkU2qADeFOchWfDZ9R3Bx11
 UxkeDFCULXHTpiJoXXGhkMoA1HiRByG1AcRYPA6bnYP2uGy9jsiqM9bilgnjiBFt1xsR
 f7EBFfv/NDQ+9Uq6oBt181pTiTgQl/zqP2zoukLjVw0VMMtOmHzNCl+8InzOkWQjYyid
 LHjidVoJY39yfJMGkVa/hHBbcWcto+cXtfnUdw4a9qlXGtNaD8jgRvq+fvznPAgJafoc
 Dj4w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:x-gm-message-state:from:to:cc:subject:date;
 bh=IE659SrDcVzKxka62Svp9cdgvk0Rfr/Ob0PQCdtzRXE=;
 b=iG7Wr+sJ8zMI5sgwOuycYm0hfAsYUKTNj8Ve/tOYaiDgRKJAWkxdaV7Iy+MsINpwTi
 YuVTOgNPO5OhcomDrnrGpjM5JgLto7I/XdUqRaXB7v98BLFitX3f9CP35ryMTwpcpJgq
 A6E3lXSe/NV7y/AWbsbiVuGO10gE1jjuF9mrp4t+LbC+Wp69xeRK88yPS3tPS52PHDgs
 IhP5vVQ9pcGbNLFsdF47oU9KYpuOLgsMJBNxR1QsMJQnM0DpwTUn16KBME8l1nRZfHQo
 NMVS24BOF9u17PxhoGtQX8jpPrm4NffXBZFx7gxjrcYu0QsHctWq6Vhcbuqznw9R2WgP
 +A8Q==
X-Gm-Message-State: ACgBeo1GoezbwH7KH78R95YseOC736hIaF6CJcYF7m879lAB6qYUxBgS
 icztMVktrOFGhlagRZ8w9DgGtUnhbbevXg==
X-Google-Smtp-Source: AA6agR7T73uQq0CRCQ42sBn9n4Ef3xISLoVTHlpNmr0gWmVcV/VgmxYWoru0DUJmTl5T5HuVIf5s/g==
X-Received: by 2002:a17:90a:cc04:b0:200:b869:5ba4 with SMTP id
 b4-20020a17090acc0400b00200b8695ba4mr13568932pju.234.1662791807519; 
 Fri, 09 Sep 2022 23:36:47 -0700 (PDT)
Received: from localhost ([1.83.154.15]) by smtp.gmail.com with ESMTPSA id
 a3-20020a170902710300b0016d3935eff0sm1485153pll.176.2022.09.09.23.36.46
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 09 Sep 2022 23:36:47 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
In-Reply-To: <83czc3bvbg.fsf@HIDDEN>
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@HIDDEN>
Date: Sat, 10 Sep 2022 14:37:41 +0800
Message-ID: <87y1urybt6.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

Eli Zaretskii <eliz@HIDDEN> writes:

>> However, it is not very clear for me how to determine programmatically if
>> given character is displayable in buffer.
>
> Make the char-displayable-p test at run time, I guess, i.e. when you
> are actually about to insert it.

This should indeed be slightly more accurate. However, it will still not
cover scenarios when, for example, an overlay at point has 'face
property that sets a font that is unable to display given char. Or do I
miss something?

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 10 Sep 2022 06:35:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 10 02:35:50 2022
Received: from localhost ([127.0.0.1]:36406 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oWu5l-00013X-NJ
	for submit <at> debbugs.gnu.org; Sat, 10 Sep 2022 02:35:49 -0400
Received: from eggs.gnu.org ([209.51.188.92]:33686)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1oWu5h-00013I-3T
 for 57693 <at> debbugs.gnu.org; Sat, 10 Sep 2022 02:35:48 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:44796)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oWu5a-0006Ia-Ca; Sat, 10 Sep 2022 02:35:39 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=NuQKgMD3RaanCF9VbzIWTTP8l9iOJ7Qf9jbkDXYH7sk=; b=IDpQJ2AdkSTU
 H4vHCocxraf9sfNDkcCqVl6fvICl9A6vmfO78UfgJYBKT42ftmqs1uKg/h0MCrWZfDyQuwraPrEBj
 0d0t0DBzifTWUZhtKpQPKbXARiZrrYE4sdYGZN7Rk+/aEKf7vPZEy03XkRQ2y7hb9tirkzErdU0an
 VYBY2hJYiWdzTzdt/1i2V6LuzTeQnfGAi/vaemTkhxH8cLTaaNgbw/rWlE31xdKcyG3jZt+Tdi9Ko
 6ST2bjGYeEP/L11jol0ZRM8l90c/51M8qStwLREnmmqkZOSScDVdqCj1f8ZVpBRc25Zd7fyC4hjk9
 6mXlhFniXyfqX/LwgxeLpw==;
Received: from [87.69.77.57] (port=3710 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oWu5Z-0004VL-Od; Sat, 10 Sep 2022 02:35:38 -0400
Date: Sat, 10 Sep 2022 09:35:18 +0300
Message-Id: <83a677buu1.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
In-Reply-To: <87a677zrtz.fsf@localhost> (message from Ihor Radchenko on Sat,
 10 Sep 2022 14:06:16 +0800)
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <CADwFkmm1_gYqjwyoL-EO8vqYfESq+AZOUVT5werh4ehNCCSfoQ@HIDDEN>
 <83k06bbweg.fsf@HIDDEN> <87a677zrtz.fsf@localhost>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57693
Cc: stefankangas@HIDDEN, 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Ihor Radchenko <yantar92@HIDDEN>
> Cc: Stefan Kangas <stefankangas@HIDDEN>,  57693 <at> debbugs.gnu.org
> Date: Sat, 10 Sep 2022 14:06:16 +0800
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> > The problem which AFAIU Ihor raised was that char-displayable-p
> > returns non-nil, when the character actually cannot be displayed.
> > This is what I'm asking: how come char-displayable-p thought it could
> > find a font for the character, when Emacs failed to find the font when
> > it was time to actually display that character?
> >
> > Ihor says that the reason could be some buffer-specific settings that
> > char-displayable-p didn't take into consideration.  If that's the
> > reason, could someone tell what those settings were in this case?
> 
> The author of the linked bug report solved the problem by installing
> some extra font. So, it was likely not a question of buffer-specific
> settings in that particular case.

Does it mean we don't understand why there was a failure in that case?
It is imperative that we do understand it, to see whether
char-displayable-p could be improved not to fail in those cases.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 10 Sep 2022 06:25:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 10 02:25:32 2022
Received: from localhost ([127.0.0.1]:36390 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oWtvn-00073S-VB
	for submit <at> debbugs.gnu.org; Sat, 10 Sep 2022 02:25:32 -0400
Received: from eggs.gnu.org ([209.51.188.92]:49468)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1oWtvZ-00072x-J5
 for 57693 <at> debbugs.gnu.org; Sat, 10 Sep 2022 02:25:30 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:46478)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oWtvU-0004u6-C7; Sat, 10 Sep 2022 02:25:12 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=Q49tCU9kUOsOYY0mLudCJ7os9bVUr2ZI8eX8qAn8MD8=; b=lpM3l09KKhhk
 plkOD+4FU9cZt66UXpuzbhKtxrSsqc93T+PEw+5ZbwRXfgwJllrrEW7sRJ6mAsMfAdOoGQrlQfSOC
 9AmLmPmZ6GHtE6eIj6YHbPQbcPy/oLPT2QKOHgM5aUwCMvfvRRQ7nLyv9nkvjxj3scrFzTTEG50Tu
 mkILfe5DyzaNJxCHqeuVDUcnk24vdWeo5EYE8F/AA5fI/S+zkqGDppuQRPnhbC7dwsP0xx5GLtpBj
 QeYHEzjiFftZGR1vlC3o+f8scfTswO4k7ed/asQWQTE3564nm/+59XiIc0Eavj66LSPMDBXLDmcK5
 GXd3gRNmIEd1rMtxSKBPiA==;
Received: from [87.69.77.57] (port=3076 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oWtvT-0007Qx-0w; Sat, 10 Sep 2022 02:25:12 -0400
Date: Sat, 10 Sep 2022 09:24:51 +0300
Message-Id: <83czc3bvbg.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
In-Reply-To: <878rmr25tk.fsf@localhost> (message from Ihor Radchenko on Sat,
 10 Sep 2022 12:48:07 +0800)
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <878rmr25tk.fsf@localhost>
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Ihor Radchenko <yantar92@HIDDEN>
> Cc: 57693 <at> debbugs.gnu.org
> Date: Sat, 10 Sep 2022 12:48:07 +0800
> 
> At least, individual buffers may have buffer-local
> face-remapping-alist that may completely change the display.

Is this what happened in the case of that user where
char-displayable-p failed to detect that the character cannot be
displayed?

> However, it is not very clear for me how to determine programmatically if
> given character is displayable in buffer.

Make the char-displayable-p test at run time, I guess, i.e. when you
are actually about to insert it.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 10 Sep 2022 06:05:31 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 10 02:05:31 2022
Received: from localhost ([127.0.0.1]:36281 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oWtcQ-0004Js-U0
	for submit <at> debbugs.gnu.org; Sat, 10 Sep 2022 02:05:31 -0400
Received: from mail-pj1-f43.google.com ([209.85.216.43]:33665)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oWtcO-0004JZ-LM
 for 57693 <at> debbugs.gnu.org; Sat, 10 Sep 2022 02:05:29 -0400
Received: by mail-pj1-f43.google.com with SMTP id
 t6-20020a17090a950600b0020063f8f964so675829pjo.0
 for <57693 <at> debbugs.gnu.org>; Fri, 09 Sep 2022 23:05:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:from:to:cc:subject:date;
 bh=kyDZTIBsKCPKJ+e4KZRI/WtsAbckXuQ2tDUJJv7+8qo=;
 b=dSfE238qjQuuQBdgnUbVBd87pT9sTCOd9A0P1RwIi/V2Mufo6J3OJtgbh6k5Ya2mNb
 hR2E0hpQLcdR67wKlj1ErAhUdV4IuIQOTPCGMayN75sIWpeIOoV5MRDoOVDPPadWIDhU
 vP24GTtcIC/U9gsRdDsdNF81NMelU0if16KKh2qlJpIvhqpmEXd5O8qCWyRfL+L9m59C
 VqeUXR/tC36RjQlsJCtsMhMjffkxYJsnIT3p+fNuLTzdcnhhzATmUE5x5a6L4bVu5bDg
 Gg/BvELRJWs5X0MxV8G7B206fionKae8Rebf/n9/skX8xNuv1c4w/ETHJ4IeHcgYwG+D
 o39g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:x-gm-message-state:from:to:cc:subject:date;
 bh=kyDZTIBsKCPKJ+e4KZRI/WtsAbckXuQ2tDUJJv7+8qo=;
 b=1kYpA3xOvRhCNNCJ8ML7J2w+wA0xuXgEfBsnj0H4fz3UNF90Whvl7rN9lBeEF9x3QN
 OKOKU7X4Vb0cvjJ7NWx8Zd9JZc/e8+PX4TeNnllQpmRzdEByI1A3eJZ+vlcTAgPkydcH
 uwAuCMmREpkEIB17AlDk2pyWWJUVJeY2qWarDRBfGaL51XeRsWJWfsBoIvHwY2MBPhto
 4wly2Hbh5yzL8G9dQNODBnc9P49avmc8OmbwzrST5E4cd077dm/o5O8FQlUzLTeb544P
 RQ9bcvg0bZNPrp1s3duB8XJ4BSUDuuJ1UuxDyIrdVfedESSISYmeyrzr7gug7r+BS1iD
 0LoQ==
X-Gm-Message-State: ACgBeo33n1d/oFD6ofX5sKcpURb3aGmYtynK21utisHb0bBsyEGuigYn
 /gWwUzzgX8xRwyNep2IxBkE=
X-Google-Smtp-Source: AA6agR7hwYICscG11Lb9s1dsnjYUcDSq3rRDMUYkpPgWVURcazfRO/UUdsYXPzyUXpIWTHg03ujDfw==
X-Received: by 2002:a17:902:f651:b0:174:3c03:6be3 with SMTP id
 m17-20020a170902f65100b001743c036be3mr16565480plg.113.1662789922553; 
 Fri, 09 Sep 2022 23:05:22 -0700 (PDT)
Received: from localhost ([1.83.154.15]) by smtp.gmail.com with ESMTPSA id
 w12-20020a63f50c000000b004296719538esm1508453pgh.40.2022.09.09.23.05.21
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 09 Sep 2022 23:05:22 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
In-Reply-To: <83k06bbweg.fsf@HIDDEN>
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <CADwFkmm1_gYqjwyoL-EO8vqYfESq+AZOUVT5werh4ehNCCSfoQ@HIDDEN>
 <83k06bbweg.fsf@HIDDEN>
Date: Sat, 10 Sep 2022 14:06:16 +0800
Message-ID: <87a677zrtz.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 57693
Cc: Stefan Kangas <stefankangas@HIDDEN>, 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

Eli Zaretskii <eliz@HIDDEN> writes:

> The problem which AFAIU Ihor raised was that char-displayable-p
> returns non-nil, when the character actually cannot be displayed.
> This is what I'm asking: how come char-displayable-p thought it could
> find a font for the character, when Emacs failed to find the font when
> it was time to actually display that character?
>
> Ihor says that the reason could be some buffer-specific settings that
> char-displayable-p didn't take into consideration.  If that's the
> reason, could someone tell what those settings were in this case?

The author of the linked bug report solved the problem by installing
some extra font. So, it was likely not a question of buffer-specific
settings in that particular case.

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 10 Sep 2022 06:03:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 10 02:03:04 2022
Received: from localhost ([127.0.0.1]:36266 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oWta4-0004Fs-0g
	for submit <at> debbugs.gnu.org; Sat, 10 Sep 2022 02:03:04 -0400
Received: from eggs.gnu.org ([209.51.188.92]:51754)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1oWta1-0004FC-Tz
 for 57693 <at> debbugs.gnu.org; Sat, 10 Sep 2022 02:03:02 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:45722)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oWtZw-0001Lh-L5; Sat, 10 Sep 2022 02:02:56 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=ZrL5wgZsE4l9h0suJDayf8kSD77uT4/FMzFxL6QHGf8=; b=eLTGltDs25yINwSrZBMN
 Wp9wsxk7aJIqLRPaJHPW1l61yveYcfj+P//VzOARXbGzPcKu+HF+khBWRCPH/KDeHbumb4tsz2HOK
 60Gix8drRSlOR9G97Fe6iDMbfxq2YYzb4p12Gf327KrVr02mV7fxxmHcr+E6khfjIphGep3MwjBz+
 oEXj30YvaiLvsJWabLtDGGz+luPaGXKViZOHd8O8IGC5rIqFhfQrVZ8ZSaK/u3l0T75UzbNDFjcfd
 tYOT5OE10qgHV6ZLfcsuQfOSOrkH10pMUjmziJrSisVKM9PYWep26nb/3tVGnxtXHKZh1ATQKMQb1
 DLFFsRK8+AN8tg==;
Received: from [87.69.77.57] (port=1722 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oWtZv-0004yK-Rh; Sat, 10 Sep 2022 02:02:56 -0400
Date: Sat, 10 Sep 2022 09:02:35 +0300
Message-Id: <83illvbwck.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <CADwFkm=z2Q_b-bwW6E5CyOP_tRVnhXWCX-x7gdePpTLSPqoECg@HIDDEN>
 (message from Stefan Kangas on Fri, 9 Sep 2022 18:25:53 -0400)
Subject: Re: bug#57693: 29.0.50;
 Is there a more reliable version of `char-displayable-p'?
References: <87v8pw1xyo.fsf@localhost> <87sfl07j9b.fsf@HIDDEN>
 <CADwFkm=z2Q_b-bwW6E5CyOP_tRVnhXWCX-x7gdePpTLSPqoECg@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57693
Cc: rpluim@HIDDEN, yantar92@HIDDEN, 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Cc: 57693 <at> debbugs.gnu.org
> From: Stefan Kangas <stefankangas@HIDDEN>
> Date: Fri, 9 Sep 2022 18:25:53 -0400
> 
> Robert Pluim <rpluim@HIDDEN> writes:
> 
> >     Ihor> False-positives are indeed not unexpected in char-displayable-p; just as
> >     Ihor> its docstring warns. However, I am now wondering if there is some more
> >     Ihor> accurate way to know if a character can be actually displayed on buffer
> >     Ihor> or not.
> >
> > IΚΌd look at the guts of `describe-char-display' in
> > "lisp/descr-text.el" for inspiration (or even use it as is). It takes
> > a `pos' argument so you may have to wrap it in `with-temp-buffer' +
> > `insert'.
> 
> I know very little about this area of Emacs, but is there any reason why
> we couldn't just (try to) make `char-displayable-p' more accurate?

From where I stand, it already is, for GUI frames.  If we discovered
some deficiency in what it does, we need to understand the deficiency
and try to remove it.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 10 Sep 2022 06:02:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 10 02:02:04 2022
Received: from localhost ([127.0.0.1]:36258 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oWtZ6-0004Dr-B5
	for submit <at> debbugs.gnu.org; Sat, 10 Sep 2022 02:02:04 -0400
Received: from eggs.gnu.org ([209.51.188.92]:40522)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1oWtYu-0004CX-UR
 for 57693 <at> debbugs.gnu.org; Sat, 10 Sep 2022 02:02:02 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:58634)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oWtYp-00018T-NM; Sat, 10 Sep 2022 02:01:47 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=FozlVz1pI0bGV6TECdZFQainmrZcHEdYNiOGOTAiDXs=; b=mxw3V8oEOS8D
 lmTXte6da4eiLdTkTSrfcKM5GjLUAc8igtJZ+CU22J9tMrQej7UWPoMYTyPSWBKvgvb96RXhPmTGb
 MCDfuFj7EPfM23UTalrCJoMCXC88kvKsDRyQqPx10c7yebIL1u74c+H3cPH4iZdYUiwZMF0GmFgmc
 7LoXXlfcT1rEytiDfly/R0v6QfTsWnwd23rvyWhkEZqCnCKzBZxmBNI/4G/8erbw9kYwVHQ2c5Tfy
 +P1iXvu3b449bhEUZNhTOWKyOqItSA+idSMrR78Qeu9rrhGSNe6laiTI7nCWyVtsC/HEu1XnU1oXq
 daIo5Kq1dkUYiyaTBNR+Zw==;
Received: from [87.69.77.57] (port=1652 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oWtYp-0004sd-6f; Sat, 10 Sep 2022 02:01:47 -0400
Date: Sat, 10 Sep 2022 09:01:27 +0300
Message-Id: <83k06bbweg.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <CADwFkmm1_gYqjwyoL-EO8vqYfESq+AZOUVT5werh4ehNCCSfoQ@HIDDEN>
 (message from Stefan Kangas on Fri, 9 Sep 2022 18:25:27 -0400)
Subject: Re: bug#57693: 29.0.50;
 Is there a more reliable version of `char-displayable-p'?
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
 <CADwFkmm1_gYqjwyoL-EO8vqYfESq+AZOUVT5werh4ehNCCSfoQ@HIDDEN>
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 57693
Cc: yantar92@HIDDEN, 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Stefan Kangas <stefankangas@HIDDEN>
> Date: Fri, 9 Sep 2022 18:25:27 -0400
> Cc: 57693 <at> debbugs.gnu.org
> 
> Eli Zaretskii <eliz@HIDDEN> writes:
> 
> > I'd need to know more details.  Why did this test fail for that user?
> 
> You can find the details here:
> https://lists.gnu.org/r/emacs-orgmode/2022-07/msg00402.html

I'm probably missing something, because I didn't see there an
explanation of the problem I was looking for.

The problem which AFAIU Ihor raised was that char-displayable-p
returns non-nil, when the character actually cannot be displayed.
This is what I'm asking: how come char-displayable-p thought it could
find a font for the character, when Emacs failed to find the font when
it was time to actually display that character?

Ihor says that the reason could be some buffer-specific settings that
char-displayable-p didn't take into consideration.  If that's the
reason, could someone tell what those settings were in this case?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 10 Sep 2022 04:55:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 10 00:55:53 2022
Received: from localhost ([127.0.0.1]:36148 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oWsX2-00047t-KP
	for submit <at> debbugs.gnu.org; Sat, 10 Sep 2022 00:55:52 -0400
Received: from mail-pg1-f174.google.com ([209.85.215.174]:35696)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oWsX0-00047f-Qx
 for 57693 <at> debbugs.gnu.org; Sat, 10 Sep 2022 00:55:51 -0400
Received: by mail-pg1-f174.google.com with SMTP id t65so3383927pgt.2
 for <57693 <at> debbugs.gnu.org>; Fri, 09 Sep 2022 21:55:50 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:from:to:cc:subject:date;
 bh=coc8qd43KTPPyc7r5nbYmdUBd3oSiG0pUjYlYWQm88Q=;
 b=B3YzJjnFlPGA2RGQ9NKwOUHcQOljU66oQafWH5YUZ6xBLgnWdUtL0Jq1968O9ZQEQu
 7Abth1rHsyj8nHx3o/pXAce/WHSJvRA8L52ILjLrb9sL2moHBIXW5ECL2K/daIIeHlhs
 qc1vtqzerEbRIHYb18OC0oBfVBiaxyPsjr9PcVWnJcBz8gmawSccrq2YjQuSWqsRlYLz
 LW9N3VgNxbP9gIvlTmoz0J5XDQerxbvAFs8k+8Jw+S+YNanCQlbYU/rQe5BLkWQZXIFI
 rJoHxWJrZ3MlCJsRfactb1Kl0f9Rng8wgaemO+8lTTZXJCQozlP9izvmgHby3+LQaxfV
 EwUw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:x-gm-message-state:from:to:cc:subject:date;
 bh=coc8qd43KTPPyc7r5nbYmdUBd3oSiG0pUjYlYWQm88Q=;
 b=ciIc413Bm28iIE5aysBVSy8Vk2oFVd8A6AHqPP212lSmAkP85fHVqJfIq6LGC4571R
 Ca31i7GnALsdqsTkYSevtEX43HmODu3dPSbEK5fcd9j16mS6ud4ccLtnkmlt3NPecYOO
 4Hqhd1MXE5aI2exdiUmjd6wZu3/K+xjeQAtVpMxmZt6AzBqgtn8MHynzbTUErzNN8/qL
 ZFgVbAkptiN+IBZvOlGaMn0DHnm7aETVdyCfvllJmcI2t9wMysvnU7LDjUrWvDMbZhl2
 a/96Jdq4zPYq4kmBGufInLOBW340h895tE/36SAjI+6IilNyClnIrNcKaNAk3cgfc1NH
 8xPA==
X-Gm-Message-State: ACgBeo0nB6G+PtqThWzWOSi5sT/qHIPyk8Rr7EPiRwDg3kV5QHp1k89l
 HmbNGicBJdgUKOyKSb5eVi8=
X-Google-Smtp-Source: AA6agR7t4d4wBvemiXV1c4PYMmiLY+E7MGgKVGYQWEed3vl6FoQt/4Qb9o6v1ma45170ieuSuZvKSw==
X-Received: by 2002:a05:6a00:1312:b0:536:fefd:e64a with SMTP id
 j18-20020a056a00131200b00536fefde64amr17171773pfu.26.1662785745092; 
 Fri, 09 Sep 2022 21:55:45 -0700 (PDT)
Received: from localhost ([1.83.154.15]) by smtp.gmail.com with ESMTPSA id
 h15-20020a170902f54f00b00172f1d0825esm1333284plf.113.2022.09.09.21.55.43
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 09 Sep 2022 21:55:44 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
In-Reply-To: <CADwFkm=z2Q_b-bwW6E5CyOP_tRVnhXWCX-x7gdePpTLSPqoECg@HIDDEN>
References: <87v8pw1xyo.fsf@localhost> <87sfl07j9b.fsf@HIDDEN>
 <CADwFkm=z2Q_b-bwW6E5CyOP_tRVnhXWCX-x7gdePpTLSPqoECg@HIDDEN>
Date: Sat, 10 Sep 2022 12:56:39 +0800
Message-ID: <8735cz25fc.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 57693
Cc: Robert Pluim <rpluim@HIDDEN>, 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

Stefan Kangas <stefankangas@HIDDEN> writes:

> I know very little about this area of Emacs, but is there any reason why
> we couldn't just (try to) make `char-displayable-p' more accurate?
>
> I'm not asking for a perfect solution, but even just making it a bit
> better might be a step forward.

From the docstring:

>> On a multi-font display, the test is only whether there is an
>> appropriate font from the selected frame's fontset to display
>> CHAR's charset in general.  Since fonts may be specified on a
>> per-character basis, this may not be accurate.

The actual font used to display char in specific buffer at specific
position may depend on various buffer-local settings, property
inheritance, and fontification (possibly modified by user). As Eli
pointed, the most accurate way to check if character can be displayed
involves trying to insert it first, letting the display engine do its
job, and checking what is the result.

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 10 Sep 2022 04:52:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 10 00:52:33 2022
Received: from localhost ([127.0.0.1]:36132 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oWsTo-00041i-Uz
	for submit <at> debbugs.gnu.org; Sat, 10 Sep 2022 00:52:33 -0400
Received: from mail-pf1-f177.google.com ([209.85.210.177]:45904)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oWsTn-00041T-6P
 for 57693 <at> debbugs.gnu.org; Sat, 10 Sep 2022 00:52:31 -0400
Received: by mail-pf1-f177.google.com with SMTP id z187so3476980pfb.12
 for <57693 <at> debbugs.gnu.org>; Fri, 09 Sep 2022 21:52:31 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:cc:to:from:from:to:cc:subject:date;
 bh=pYsSvlKe6VeF8/qvaySZa/oPgb4qWy0m6UCqDetLT6M=;
 b=HByVH1I2GjxSZ9wkbordKMF1cMl8a4SPDM6kmbfYUc7/KTEAT930XDYUUQnP/BLr3x
 WiAmTQaW5M3ehTYxVBTWvrUS5++7OPT68fDsDesBrVrHe4Ov2lh1wrFFE8d6jT1W60Fp
 EGzUIoBz24I2Qu/wZK4H7THMhN7SKR0aS8g9g12MKATxuygpGFBFB7WQVodz+Fpla5xc
 u9isEbuC/65/DDX5DzpicEWOGntndY6YqJfxdsGbZ8ufUcukuOkb8aVkhfUAJVIjbf/q
 pRc21p6Hl8MDtWNNkx5p2E8v+9BXAqWCJ590yLWxr4ij9wVORVbNYD8qWp3gMGux09Sz
 lmEw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date;
 bh=pYsSvlKe6VeF8/qvaySZa/oPgb4qWy0m6UCqDetLT6M=;
 b=BHtYZ9IyK6rFktrSTJJ4meRpgEbxF24vL4ZJwqHTf+YRiHDXr+wX1iL/dUygpHPtaQ
 QMW42yR93dPgbDFCi8TvZUbkehu6o4ajclFkgafsRwS03GfSlKWt2tUMpos2qq/UesJl
 K0EFtxmwNRPpcEyTTn5K0M9YE41nFNSy707cfopcdCuieId12dmEuP+WR5dTw09dvREZ
 HI4/b1QZq5gV/yoCZjdmeKwghGH55cOK8sjqMmH2U4isaM2ca/oXjurdrXbYQntR9n+n
 OMTVTLehR8AB9q1zBhdvqcr3d3n2L2rt9QdynvKrzl4sUFtJzczngIeWr83ClHtIx5vj
 JsYA==
X-Gm-Message-State: ACgBeo1En3HerMmf9yP+js3WpPB3rf7mnDdJqh03J47FcfzgGW+jiJUf
 P6NxYLYTFOw7sNo3YLeHbyo=
X-Google-Smtp-Source: AA6agR5H5kIfmv7MzIJ8wGjwQQp1AyW2yBUMbVOIZSujqAJVdZb9/CnXi+27b3jmbJy1dTsIfk71hw==
X-Received: by 2002:a05:6a00:2395:b0:52f:723c:363 with SMTP id
 f21-20020a056a00239500b0052f723c0363mr17349372pfc.21.1662785545463; 
 Fri, 09 Sep 2022 21:52:25 -0700 (PDT)
Received: from localhost ([1.83.154.15]) by smtp.gmail.com with ESMTPSA id
 z8-20020aa79e48000000b0053b850b17c8sm636691pfq.152.2022.09.09.21.52.24
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 09 Sep 2022 21:52:24 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Robert Pluim <rpluim@HIDDEN>
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
In-Reply-To: <87sfl07j9b.fsf@HIDDEN>
References: <87v8pw1xyo.fsf@localhost> <87sfl07j9b.fsf@HIDDEN>
Date: Sat, 10 Sep 2022 12:53:19 +0800
Message-ID: <875yhv25kw.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

Robert Pluim <rpluim@HIDDEN> writes:

> I=CA=BCd look at the guts of `describe-char-display' in
> "lisp/descr-text.el" for inspiration (or even use it as is). It takes
> a `pos' argument so you may have to wrap it in `with-temp-buffer' +
> `insert'.

`with-temp-buffer' is not a good option because it may have different
buffer-local environment compared to the actual buffer.

As for `describe-char-display', do you refer to `internal-char-font'?
`internal-char-font' is "For internal use only." though. Or can we get
something out of the `describe-char-display' return value? This function
does not have a docstring, and it is not very clear what the possible
return values can be and which return values are indicative of
non-displayable characters.

--=20
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 10 Sep 2022 04:47:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Sep 10 00:47:24 2022
Received: from localhost ([127.0.0.1]:36118 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oWsOq-0003rK-En
	for submit <at> debbugs.gnu.org; Sat, 10 Sep 2022 00:47:24 -0400
Received: from mail-pf1-f182.google.com ([209.85.210.182]:40534)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oWsOl-0003r3-LN
 for 57693 <at> debbugs.gnu.org; Sat, 10 Sep 2022 00:47:23 -0400
Received: by mail-pf1-f182.google.com with SMTP id b144so3485159pfb.7
 for <57693 <at> debbugs.gnu.org>; Fri, 09 Sep 2022 21:47:19 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:from:to:cc:subject:date;
 bh=HK0Dkd6QtOjloEDy5r/VBnvF79GWYsUXoHhV5odnllg=;
 b=ZT0rgjmDTDLxP2Kc9u5UB3NcSTuzaWV25/h+BQk9wbIH3YKBWCMeR90qQVgcKrmaed
 FmRuEsN92ABx9wtNViDAUa4izXA1WV19dkzB54OuWCxBVo5XaK/agb+djc6e3QA9BNMm
 mK88ihLmOdwQq8GaXEzQ8UgsuxU+7leFoTEyoJGwQL84XC7esKJNJraJBVvBdbpytrHM
 Dxelw/EEa5Z9ZEcjLnvAeYrXoubFoCkYtyJ54/YdEfKuovR613hziy9h9rmpLccBgQUI
 fTwecE2E28kCkuUUUOaLKrpLu3TCEUJ573S1xst379ejlBzS6Sz4KhjxqrtgVKy0kpP1
 2kVw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:message-id:date:references:in-reply-to:subject:cc:to
 :from:x-gm-message-state:from:to:cc:subject:date;
 bh=HK0Dkd6QtOjloEDy5r/VBnvF79GWYsUXoHhV5odnllg=;
 b=mILvnkx8zdJgoOKOM7x5cRKIil73G03aOowT91qB3Q0TxOHWfGM6MpiO8F7fl8nO9Y
 BSptvrr+axijYFKq3db27Xo3TvmHDqIdVMR1vc7gfiFUrL4taVU10zoEzifzyIrJZjGL
 wAyanXNfJmj4NhyXE51YP/Lfzb5fhsS7T6OEfnTqBKLcod7OIfm82wLM5OR8ls16BmVe
 w2yUexe1n/3rABo9dSRR09R6YeyeOdhGuN8qnyJSCWViQ08zBaYw6bdawoYfFT8oKnHE
 vNIjRzG1wpMq9guyqsw34zSMbesDxzLSmcSUxCkDmH7No0cqvn4ccRYWbDv+qSXNYFNG
 JRLw==
X-Gm-Message-State: ACgBeo2HbvwMVlRfDkcB0qe1NoJxmRJKbJCKD5ROP8xgLsRK1Kecd5Ch
 /AqK1tS0ZCfcXKmH5LXPnQA=
X-Google-Smtp-Source: AA6agR66MQ5SK9q+lwlXqMe9RZINIaps8+A1w+kzOpcLzBQ31JLTbPp/bGu6u2re/Gz4Qj1/yVzfbA==
X-Received: by 2002:a05:6a02:309:b0:434:efcb:ccf4 with SMTP id
 bn9-20020a056a02030900b00434efcbccf4mr13074688pgb.304.1662785233663; 
 Fri, 09 Sep 2022 21:47:13 -0700 (PDT)
Received: from localhost ([1.83.154.15]) by smtp.gmail.com with ESMTPSA id
 y14-20020a1709029b8e00b001745919b197sm1263047plp.243.2022.09.09.21.47.12
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 09 Sep 2022 21:47:13 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
In-Reply-To: <83a678d5w6.fsf@HIDDEN>
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
Date: Sat, 10 Sep 2022 12:48:07 +0800
Message-ID: <878rmr25tk.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.2 (/)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.8 (/)

Eli Zaretskii <eliz@HIDDEN> writes:

> Also, what exactly does the test above intend to test?  Are you
> interested in whether this character can be displayed at all,
> regardless of which font is to be used, or do you want it to be
> displayed with the default face's font?
>
> To answer your question: the most accurate way is to actually try
> displaying the character and see if that works.  Not sure if it helps
> you, though especially since that code is in a defcustom, AFAIU.

Makes sense. Trying to determine if a character can be displayed
a-priori in defcustom was just the "easy" approach.

It makes sense that we must try to insert the character first in order
to know if it can be displayed. At least, individual buffers may have
buffer-local face-remapping-alist that may completely change the
display.

However, it is not very clear for me how to determine programmatically if
given character is displayable in buffer.

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 9 Sep 2022 22:26:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 09 18:26:03 2022
Received: from localhost ([127.0.0.1]:35872 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oWmRn-00072a-J3
	for submit <at> debbugs.gnu.org; Fri, 09 Sep 2022 18:26:03 -0400
Received: from mail-oa1-f47.google.com ([209.85.160.47]:38497)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1oWmRj-00071x-Jf
 for 57693 <at> debbugs.gnu.org; Fri, 09 Sep 2022 18:26:02 -0400
Received: by mail-oa1-f47.google.com with SMTP id
 586e51a60fabf-1278624b7c4so7601234fac.5
 for <57693 <at> debbugs.gnu.org>; Fri, 09 Sep 2022 15:25:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:from:to:cc:subject:date;
 bh=2OMqnHpI2CimujFwC8FID/M78sHipo2ace14UUnfVJ8=;
 b=ScNCDC5IM7mREcmhv6mwhFiknTtAqf/erlOF1NZ0GXMRRrIVFwRSONFWjGyT5o2z0G
 oz7ds7G9bQ9zV8ejlSJQXtaXjxwuGtqxKZfS7jxkyDnyXpAtmQ8RVt2LA8ZwbFnwCYKg
 EEhrS2dOzgy3dEwGg3LmWAiwDDY1g7ygOzUyCaY27jOiez/wsyJgMZKn/b7uv4bNJS8b
 q8LCoKuQnowJp07TIDObeXZ0Rb626v54sj1TaiAGKSIWV28NAaHCVzzlQknISk3sTtUj
 FEFJ2BTFCNhvb/lr8no8p0eZ3lMYeoEg3pOMsysYdaRovr2Z7E8zp9HUL5o/U0URIwjH
 KK3Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:cc:to:subject:message-id:date
 :mime-version:references:in-reply-to:from:x-gm-message-state:from:to
 :cc:subject:date;
 bh=2OMqnHpI2CimujFwC8FID/M78sHipo2ace14UUnfVJ8=;
 b=eNBR1yrqmruQskIxbwuzvVFkNOZBBTP32sZQRJiStOwHXs9IADIgdQcML1HERklhpK
 nzfinsDI7ckjJJ5sdagJwk3XfbSkRX8hAATEqiP8pcLjXhFG9zN8AkoIFL105Pq47z7p
 YhTrsoyEE8sDKN+JDIJDRSXA0236jBK45WS1iOE8e8URFo0GfcniQsZWg3cqVgsRBH7v
 1leyR+o58eTKdP+3qGjnWK6P86aHjYuIU3is+IkNbZfA/9pULcoWtPjxPRsW8G163ORc
 MyE/gZOU8ulANC5a0j2FUQDLtVLRHKAy5u43hX1jsFZD/dMXwWExCflZnEIaKFSkSHS2
 3gNg==
X-Gm-Message-State: ACgBeo3QhunroERXQ1hKolGK94aWxrT9UJz3b1p6SlgC9JrJChwLBdY0
 pzVBArXCGX1ZBE3mdMmMQc4v3/lIJ5mxvbjdQ23ZNrKM
X-Google-Smtp-Source: AA6agR5ekW4zOY1zPkE/9tOsuSS1nLMqywk8/G+CnQOLOuUazyIMcDODcgqwicUS7Ia2mazdArbkixIpLBjWte429Fw=
X-Received: by 2002:a05:6870:538c:b0:11b:e64f:ee1b with SMTP id
 h12-20020a056870538c00b0011be64fee1bmr5898426oan.92.1662762354179; Fri, 09
 Sep 2022 15:25:54 -0700 (PDT)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Fri, 9 Sep 2022 18:25:53 -0400
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <87sfl07j9b.fsf@HIDDEN>
References: <87v8pw1xyo.fsf@localhost> <87sfl07j9b.fsf@HIDDEN>
X-Hashcash: 1:20:220909:57693 <at> debbugs.gnu.org::XGZ9U1N7g30oeq7w:1hlc
MIME-Version: 1.0
Date: Fri, 9 Sep 2022 18:25:53 -0400
Message-ID: <CADwFkm=z2Q_b-bwW6E5CyOP_tRVnhXWCX-x7gdePpTLSPqoECg@HIDDEN>
Subject: Re: bug#57693: 29.0.50;
 Is there a more reliable version of `char-displayable-p'?
To: Robert Pluim <rpluim@HIDDEN>, Ihor Radchenko <yantar92@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Robert Pluim <rpluim@HIDDEN> writes:

>     Ihor> False-positives are indeed not unexpected in char-displayable-p=
; just as
>     Ihor> its docstring warns. However, I am now wondering if there is so=
me more
>     Ihor> accurate way to know if a character can be actually displayed o=
n buffer
>     Ihor> or not.
>
> I=CA=BCd look at the guts of `describe-char-display' in
> "lisp/descr-text.el" for inspiration (or even use it as is). It takes
> a `pos' argument so you may have to wrap it in `with-temp-buffer' +
> `insert'.

I know very little about this area of Emacs, but is there any reason why
we couldn't just (try to) make `char-displayable-p' more accurate?

I'm not asking for a perfect solution, but even just making it a bit
better might be a step forward.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 9 Sep 2022 22:25:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 09 18:25:36 2022
Received: from localhost ([127.0.0.1]:35868 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oWmRM-00071X-6n
	for submit <at> debbugs.gnu.org; Fri, 09 Sep 2022 18:25:36 -0400
Received: from mail-oa1-f51.google.com ([209.85.160.51]:46645)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1oWmRJ-000715-PX
 for 57693 <at> debbugs.gnu.org; Fri, 09 Sep 2022 18:25:34 -0400
Received: by mail-oa1-f51.google.com with SMTP id
 586e51a60fabf-12ab0eaa366so7512889fac.13
 for <57693 <at> debbugs.gnu.org>; Fri, 09 Sep 2022 15:25:33 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:from:to:cc:subject:date;
 bh=xZUa2qjG5iIXVylqaRkXlJAdawa0FZ6h5NrZHzfHGso=;
 b=fWjKLdujXDpl6F4gy9XXQPjI+G3lI3ZcWfR9Y9ewZqUrBQhcndtHmAYDPaWaADoZXf
 yAWYioBR7bOUzb7AUL4qzhdQyeiSbPlKUhEmiEKNzGgnP6bjYVldOuEWejtqOeuhiiyM
 F3zNXZ0I018v18sHrXE6vfmCDV7PQs6pOmBvRO/waoqyXDDOLCeSNLd9PbYn/Y+Vj3vm
 SbRoBmv5KYepvO71QSwh921/7wu6FlQu5IXGjXWdG6skLZyAiD6eHay3NRGDbDVhAnmC
 JL1+iuAY+vurWCC4QLfHPfhHZ+dCUMmj2DEG1P86ro1TXyoEIX8Am1zGZ5tXnRZGUb3C
 b5mw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:x-gm-message-state:from:to:cc:subject:date;
 bh=xZUa2qjG5iIXVylqaRkXlJAdawa0FZ6h5NrZHzfHGso=;
 b=nGpKraSS9Zqy/s9dZJIExtvulZZqmd9fL7n7+s+BeacRXl/N+DG6JCsIoGlCsQTiLH
 KZlKCYuNRcTmS+6HG8MvS/qaAv3wKrz4SQI1g69vwgJS7bU2FwJKH2shcmwTp1QyAhFJ
 VogD52kRsN4AwZVo/RVqONV180gQSekhPwZ81x1W5kkAWnJOG6ngFff4ibpgvl2F67Yw
 0aj4OR0AMzZbWlsKGRav15zcTA0GBXTgCAnUL7pkWQ4ACsKo8hY3E2DvKw35z29IfEzE
 mOOseJOqVzc41jrjCLqbyT6wsgKrOKKPthnvDS30C9nhcUMAqHcytHbpgtllwIaVPaBp
 3cTw==
X-Gm-Message-State: ACgBeo2GNtQ0hWakrVgwKozEgZlMbOTC2+VvRNqCXq95fson38cDINOP
 gc8tmZpYNIA0AZzpHK0SBNPqrZEJLOqCqjtqCIE=
X-Google-Smtp-Source: AA6agR4ufRosBLkopw4zgi8xwI1M8a4ww58KCftlNPbe4MJ+R7HqFElw6LYi3CA2sxv+xrbHT6bx9Poqxj1ecoDQCqI=
X-Received: by 2002:a05:6870:5581:b0:11e:300:8189 with SMTP id
 n1-20020a056870558100b0011e03008189mr6099677oao.199.1662762328106; Fri, 09
 Sep 2022 15:25:28 -0700 (PDT)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Fri, 9 Sep 2022 18:25:27 -0400
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <83a678d5w6.fsf@HIDDEN>
References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@HIDDEN>
X-Hashcash: 1:20:220909:yantar92@HIDDEN::Yv7nVz3+LcK4LLze:Dbgd
MIME-Version: 1.0
Date: Fri, 9 Sep 2022 18:25:27 -0400
Message-ID: <CADwFkmm1_gYqjwyoL-EO8vqYfESq+AZOUVT5werh4ehNCCSfoQ@HIDDEN>
Subject: Re: bug#57693: 29.0.50;
 Is there a more reliable version of `char-displayable-p'?
To: Eli Zaretskii <eliz@HIDDEN>, Ihor Radchenko <yantar92@HIDDEN>
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Eli Zaretskii <eliz@HIDDEN> writes:

> I'd need to know more details.  Why did this test fail for that user?

You can find the details here:
https://lists.gnu.org/r/emacs-orgmode/2022-07/msg00402.html

Alternative link to the same thread:
https://list.orgmode.org/27918f90-4a82-9f70-611e-7fc5475e2e60@HIDDEN/

> Also, what exactly does the test above intend to test?  Are you
> interested in whether this character can be displayed at all,
> regardless of which font is to be used, or do you want it to be
> displayed with the default face's font?

The purpose of the test is to figure out if we should use the pretty
UTF-8 characters or if we should use the less pretty ASCII ones.

The result is then used in the org agenda buffer.  So it had better
display, basically.  The problem is that some users saw that they got
the UTF-8 characters with the above code, but they displayed as the
"hex-squares" (I forget the official name).

> To answer your question: the most accurate way is to actually try
> displaying the character and see if that works.  Not sure if it helps
> you, though especially since that code is in a defcustom, AFAIU.

That doesn't help here, unfortunately.  :-(

We would need a way to figure this out programmatically.  (It's in a
defcustom, yes.)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 9 Sep 2022 13:46:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 09 09:46:50 2022
Received: from localhost ([127.0.0.1]:32912 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oWeLJ-0000RL-RB
	for submit <at> debbugs.gnu.org; Fri, 09 Sep 2022 09:46:50 -0400
Received: from mail-wr1-f52.google.com ([209.85.221.52]:39496)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rpluim@HIDDEN>) id 1oWeLI-0000R9-7W
 for 57693 <at> debbugs.gnu.org; Fri, 09 Sep 2022 09:46:48 -0400
Received: by mail-wr1-f52.google.com with SMTP id n12so2828946wru.6
 for <57693 <at> debbugs.gnu.org>; Fri, 09 Sep 2022 06:46:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:cc:to:from:from:to:cc:subject:date;
 bh=zhmYfvjkbc4cm2GxajUOhiW65c+mB2HScLckc9vU50A=;
 b=Pkt/mz1dbuNzzWM/HCxmQtmDHgC5a8SSgF1c6fDM/rbhHS0T4wYItWaxQEJphaNdC0
 9pcuFbhMnEkxCKT3TbPnZ30sTIj9mkMTeEGwFIzSvBT60/bcnLR4sIAfv2dPDbbXqk4n
 jD1mQYFpTU2B/heQO2w8U5zeVreOb2yZf3KBknmm7mBWaHtl07PB0b0nGsD9EMeGTWUE
 y2Nv6VOmpOOuqw7uKeiVCxEzPsyRVjVMirHqLtypIEJ8lrrE7o2liQUfQoaRbBH3RNH1
 OyGIAKJeVMlREUp/YJvq4ktmymy32JdEdut2OJEh/x94ow8xVCBk1oN5Uc+4HEKoQWKr
 V8mQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:references
 :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date;
 bh=zhmYfvjkbc4cm2GxajUOhiW65c+mB2HScLckc9vU50A=;
 b=ho4e099gY/bD1Cb5YMo3IHz+mtLwvd09GWToS6P2uz/3A0a5QwYQqqIBkMez/B/WLP
 BntLAFUKv0yl3UcHANd9NlKO/l9mWSTSmWPAqEbMA0X+b83n22WNHt9Fj2OAoucmCcEx
 8555vgbJa/0qaC0wFdGORcxYpx3cRciBaNGDUuEZjByZJQfHxZ7Yeofbv7AeeVlD73Ds
 6+jLMM3/Vb7cg+TxHiLQVkQTB1hPEhng2kFvEWIdoQrJV7S/SGp/o/CZ6PfnoHCl5GNW
 QTKHJuTfIebVFaOqVSGoqe5wQSYCG39MxXowwMzUVUL3a/9k1Mw5COLGBx4T5hv0gdnc
 4gnQ==
X-Gm-Message-State: ACgBeo2yWAiJn2frtfMoDPyy7Fw8SDlZC4UL/SAuw62okeU8h3PTCj7R
 1Gvkznl5VCDlpwyuXWiKCaD/lnHWXRI=
X-Google-Smtp-Source: AA6agR4ZAIIN9GaIIIrUvvQbhv8xA6r/KzxmSVqCImU/G6nE++B0yxurQe4O3fFNy7gxD6R6/5T5zw==
X-Received: by 2002:adf:f90d:0:b0:20c:de32:4d35 with SMTP id
 b13-20020adff90d000000b0020cde324d35mr8011286wrr.583.1662731201840; 
 Fri, 09 Sep 2022 06:46:41 -0700 (PDT)
Received: from rltb ([2a01:e0a:3f3:fb50:a290:d8f3:806c:3938])
 by smtp.gmail.com with ESMTPSA id
 l16-20020a5d5610000000b0021e43b4edf0sm568641wrv.20.2022.09.09.06.46.40
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 09 Sep 2022 06:46:41 -0700 (PDT)
From: Robert Pluim <rpluim@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
Subject: Re: bug#57693: 29.0.50; Is there a more reliable version of
 `char-displayable-p'?
In-Reply-To: <87v8pw1xyo.fsf@localhost> (Ihor Radchenko's message of "Fri, 09
 Sep 2022 21:25:35 +0800")
References: <87v8pw1xyo.fsf@localhost>
Date: Fri, 09 Sep 2022 15:46:40 +0200
Message-ID: <87sfl07j9b.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>>>>> On Fri, 09 Sep 2022 21:25:35 +0800, Ihor Radchenko <yantar92@HIDDEN=
m> said:

    Ihor> Hello,
    Ihor> In Org, we have recently had a need to check if a Unicode charact=
er can
    Ihor> be displayed in buffer.

    Ihor> We used the following:
    Ihor> (...
    Ihor>   (if (and (display-graphic-p)
    Ihor>            (char-displayable-p ?=E2=AD=A0)
    Ihor>            (char-displayable-p ?=E2=94=80))
    Ihor>       "=E2=AD=A0 now =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80"
    Ihor>     "now - - - - - - - - - - - - - - - - - - - - - - - - -")
    Ihor> ...)

    Ihor> However, char-displayable-p returned false-positive for one user:
    Ihor> https://list.orgmode.org/orgmode/87mtddhprr.fsf@localhost/=20

    Ihor> False-positives are indeed not unexpected in char-displayable-p; =
just as
    Ihor> its docstring warns. However, I am now wondering if there is some=
 more
    Ihor> accurate way to know if a character can be actually displayed on =
buffer
    Ihor> or not.

I=CA=BCd look at the guts of `describe-char-display' in
"lisp/descr-text.el" for inspiration (or even use it as is). It takes
a `pos' argument so you may have to wrap it in `with-temp-buffer' +
`insert'.

Robert
--=20




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at 57693 <at> debbugs.gnu.org:


Received: (at 57693) by debbugs.gnu.org; 9 Sep 2022 13:39:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 09 09:39:12 2022
Received: from localhost ([127.0.0.1]:32903 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oWeDw-0000Ev-Jh
	for submit <at> debbugs.gnu.org; Fri, 09 Sep 2022 09:39:12 -0400
Received: from eggs.gnu.org ([209.51.188.92]:39224)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1oWeDr-0000Ee-Rf
 for 57693 <at> debbugs.gnu.org; Fri, 09 Sep 2022 09:39:10 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:49338)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oWeDl-0002in-Rx; Fri, 09 Sep 2022 09:39:02 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=BreaB/lNL1DhZiR+wo7kiM5yX5tHiNvI2ipXpSxGUJU=; b=K5HcBOHD54D1YuekVyhw
 5FzpXo76H7ijAx9lYMB+zIhB+sJzxNLQ1aoikuQ09EU+CdroRBCi/GeiN/PdIF+trDFuARpbtEhBM
 I8rYLw38RJABmj2HAaFJsFhTkE3JlOtQDmhDiWrcKMwJ1fIV7zsEkhHDWy3K/3JADJ5mG0EhwuF4C
 pnljJst2uGyz7bZN2cvNbOGTgFGAz8C/InfM2w12lEvqwxs4puHWX6VK9vgYMePhVTtVNvhapsldo
 v7lwWeymVgwu3slTqdhP9GC5GNNOdBX8uRLbQRMUdoYo8TCy4jGi4vMY2JqhiQueAJpZanC2Cj7eK
 Cg9xDn0iPI2bcA==;
Received: from [87.69.77.57] (port=1451 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1oWeDl-0000l0-BC; Fri, 09 Sep 2022 09:39:01 -0400
Date: Fri, 09 Sep 2022 16:38:49 +0300
Message-Id: <83a678d5w6.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Ihor Radchenko <yantar92@HIDDEN>
In-Reply-To: <87v8pw1xyo.fsf@localhost> (message from Ihor Radchenko on Fri,
 09 Sep 2022 21:25:35 +0800)
Subject: Re: bug#57693: 29.0.50;
 Is there a more reliable version of `char-displayable-p'?
References: <87v8pw1xyo.fsf@localhost>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 57693
Cc: 57693 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Ihor Radchenko <yantar92@HIDDEN>
> Date: Fri, 09 Sep 2022 21:25:35 +0800
> 
> In Org, we have recently had a need to check if a Unicode character can
> be displayed in buffer.
> 
> We used the following:
> (...
>   (if (and (display-graphic-p)
>            (char-displayable-p ?β­ )
>            (char-displayable-p ?─))
>       "β­  now ───────────────────────────────────────────────"
>     "now - - - - - - - - - - - - - - - - - - - - - - - - -")
> ...)
> 
> However, char-displayable-p returned false-positive for one user:
> https://list.orgmode.org/orgmode/87mtddhprr.fsf@localhost/ 
> 
> False-positives are indeed not unexpected in char-displayable-p; just as
> its docstring warns. However, I am now wondering if there is some more
> accurate way to know if a character can be actually displayed on buffer
> or not.

I'd need to know more details.  Why did this test fail for that user?

Also, what exactly does the test above intend to test?  Are you
interested in whether this character can be displayed at all,
regardless of which font is to be used, or do you want it to be
displayed with the default face's font?

To answer your question: the most accurate way is to actually try
displaying the character and see if that works.  Not sure if it helps
you, though especially since that code is in a defcustom, AFAIU.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 9 Sep 2022 13:24:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Sep 09 09:24:52 2022
Received: from localhost ([127.0.0.1]:32869 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oWe03-0008Jx-TG
	for submit <at> debbugs.gnu.org; Fri, 09 Sep 2022 09:24:52 -0400
Received: from lists.gnu.org ([209.51.188.17]:43092)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oWdzx-0008Jk-Il
 for submit <at> debbugs.gnu.org; Fri, 09 Sep 2022 09:24:51 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:58186)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <yantar92@HIDDEN>)
 id 1oWdzx-00051j-Dx
 for bug-gnu-emacs@HIDDEN; Fri, 09 Sep 2022 09:24:45 -0400
Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:42909)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <yantar92@HIDDEN>)
 id 1oWdzv-0007Ya-OK
 for bug-gnu-emacs@HIDDEN; Fri, 09 Sep 2022 09:24:45 -0400
Received: by mail-pj1-x102c.google.com with SMTP id
 n65-20020a17090a5ac700b001fbb4fad865so1559163pji.1
 for <bug-gnu-emacs@HIDDEN>; Fri, 09 Sep 2022 06:24:43 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:subject:to
 :from:from:to:cc:subject:date;
 bh=20Bh+GPwoUKlzh3LutQF1eRi+xnHUhiUSLDfBd2XS+Y=;
 b=VQ7DUlb6UXWS0QDULy3S9CG3whDcjIKnp0ByNyz/MOuHBOFb01mgQS0jjegriTbAEk
 zVXzdmFZouGA/MI230Kuq7wtPOXfexzwO+NQGZ13oB2EsN1niegw+Gwj5GH37F+lbn/c
 b6og8Zm6WH+eGyDVYBStKwUx/a/b+0EZ3py0i42NGoLoLSZfAM3mttfPMuLs5vyn09/n
 1D5m9GwFE6s4IHJ1sB281UDxSkskYgvnaBsLNnfo/2mSz3+R9k2cEol2aZXGLDtbgAuO
 AwVmEl7xn5ODcCDVITFQnjYHmWw72v+ucn3juD5f9QQOw6MNaz3vvGgSUiAh+cspEZga
 GIDw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:message-id:date:subject:to
 :from:x-gm-message-state:from:to:cc:subject:date;
 bh=20Bh+GPwoUKlzh3LutQF1eRi+xnHUhiUSLDfBd2XS+Y=;
 b=2PWjoHa2GQ0/6ZeUy0Tof67oDwZvtNSaZOUrIrRORyq8444Y7l9Wn5yNhrPiID2zep
 L84qHK1aF1vl5f9seraOUoBf7fjrzELGTMUXTEqAO7ZfFQkb7Fw0EddYdy1w7LZtk1Vo
 4jt4NCdYeywWx5l/zHfEbMO7Ma9dd4BanIP+P45JhNsCs1PrORRwRcJj6rnBSyejIZT3
 rTdQOngaHWVkft6KX7/wDoLxpmXZXN1uGJCnqL36r6HXeD1k5Ku/XFkU8834eIt9qbxF
 n2i0wcLuTLoRuhBzIMeAOS8ADBvC7vkVL0VZgNqIT/o4fmU2J48JwlO2kCVkuwvWfYEj
 pZYA==
X-Gm-Message-State: ACgBeo3PLFMTEmlZYFqQYUZAN7IspgV9UUcRVPDVnTxBC0RGKGRG6wNz
 AA31A5HVU86Mdzw0516+zBrkVu0rktw=
X-Google-Smtp-Source: AA6agR6etUl5p3sbwM2CVYAuGHJlDsHZOlQi7X/vNE7BJq/v0eo+u3r0oqR7MSO35qN9YDFNhkISgw==
X-Received: by 2002:a17:902:e312:b0:176:9348:1f6e with SMTP id
 q18-20020a170902e31200b0017693481f6emr13911316plc.14.1662729882098; 
 Fri, 09 Sep 2022 06:24:42 -0700 (PDT)
Received: from localhost ([2409:8a70:2b2:5800:8ec6:81ff:fe70:339d])
 by smtp.gmail.com with ESMTPSA id
 x1-20020aa79561000000b0053e22fc5b4fsm578361pfq.0.2022.09.09.06.24.40
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 09 Sep 2022 06:24:41 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 29.0.50; Is there a more reliable version of `char-displayable-p'?
Date: Fri, 09 Sep 2022 21:25:35 +0800
Message-ID: <87v8pw1xyo.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=2607:f8b0:4864:20::102c;
 envelope-from=yantar92@HIDDEN; helo=mail-pj1-x102c.google.com
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.1 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.1 (--)

Hello,

In Org, we have recently had a need to check if a Unicode character can
be displayed in buffer.

We used the following:
(...
  (if (and (display-graphic-p)
           (char-displayable-p ?=E2=AD=A0)
           (char-displayable-p ?=E2=94=80))
      "=E2=AD=A0 now =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=
=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=
=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=
=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80"
    "now - - - - - - - - - - - - - - - - - - - - - - - - -")
...)

However, char-displayable-p returned false-positive for one user:
https://list.orgmode.org/orgmode/87mtddhprr.fsf@localhost/=20

False-positives are indeed not unexpected in char-displayable-p; just as
its docstring warns. However, I am now wondering if there is some more
accurate way to know if a character can be actually displayed on buffer
or not.

--=20
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92




Acknowledgement sent to Ihor Radchenko <yantar92@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#57693; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 19 Feb 2023 12:30:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.