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; 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: Tue, 13 Sep 2022 11:30:02 UTC

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