From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#57693: 29.0.50; Is there a more reliable version of `char-displayable-p'? Date: Sat, 18 Feb 2023 11:18:18 +0200 Message-ID: <83lekvz605.fsf@gnu.org> References: <87v8pw1xyo.fsf@localhost> <83a678d5w6.fsf@gnu.org> <878rmr25tk.fsf@localhost> <83czc3bvbg.fsf@gnu.org> <87y1urybt6.fsf@localhost> <837d2bbr2s.fsf@gnu.org> <87edwjy77h.fsf@localhost> <831qsjboy0.fsf@gnu.org> <87v8puw945.fsf@localhost> <838rmq9rfr.fsf@gnu.org> <837d2a9qcu.fsf@gnu.org> <875yhtw3ed.fsf@localhost> <831qmo146g.fsf@gnu.org> <83wn4fzcl5.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20404"; mail-complaints-to="usenet@ciao.gmane.io" Cc: yantar92@gmail.com, 57693@debbugs.gnu.org To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 18 10:19:16 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pTJND-00059L-1e for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 18 Feb 2023 10:19:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pTJN7-0002pJ-Qd; Sat, 18 Feb 2023 04:19:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pTJN5-0002oz-Km for bug-gnu-emacs@gnu.org; Sat, 18 Feb 2023 04:19:07 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pTJN0-0005GE-Lw for bug-gnu-emacs@gnu.org; Sat, 18 Feb 2023 04:19:07 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pTJN0-0005OF-H1 for bug-gnu-emacs@gnu.org; Sat, 18 Feb 2023 04:19:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 18 Feb 2023 09:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57693 X-GNU-PR-Package: emacs Original-Received: via spool by 57693-submit@debbugs.gnu.org id=B57693.167671190520663 (code B ref 57693); Sat, 18 Feb 2023 09:19:02 +0000 Original-Received: (at 57693) by debbugs.gnu.org; 18 Feb 2023 09:18:25 +0000 Original-Received: from localhost ([127.0.0.1]:42469 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pTJMP-0005NC-Hb for submit@debbugs.gnu.org; Sat, 18 Feb 2023 04:18:25 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:32906) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pTJMN-0005Mv-SW for 57693@debbugs.gnu.org; Sat, 18 Feb 2023 04:18:24 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pTJMI-00056m-HC; Sat, 18 Feb 2023 04:18:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=7ZqO/iPHa6sHba0p/tioS1HtclcK7UzOLlO0hdLFQcI=; b=RtHjH4TRLkF3 jYDD1RwNMpLxcN7xL2LGbVneVXbPJ58imnXORKtZBVfpvGOwKwPT1HANip7JWs/XqfAoKiAUvWwfu o1qklOb+rE0lgAQJ+uUohhIh4me8GYu8suxgRib5L1rulQIteTFbD+mB1vEPb0UkMf8om+z/4RHXF 7TPcHg2A2SXQyiA5RV1hcy2nPXO8yKHL2+rm+2fIFdGMIYgTqgdt4JA1btpyH2Zuk8opdbPz7Cq3/ LAElS95m2WqPQKUfebg2PMrv5B+4BtfDtK/Gv41/UpU31v9+Nhg7E2KMJhk0elVDMgjdT5NlM3Tqo RP1p9B0dA4+SBEu2k5oaAQ==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pTJMH-0000L6-SB; Sat, 18 Feb 2023 04:18:18 -0500 In-Reply-To: (message from Stefan Kangas on Sat, 18 Feb 2023 01:00:38 -0800) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:255945 Archived-At: > From: Stefan Kangas > Date: Sat, 18 Feb 2023 01:00:38 -0800 > Cc: yantar92@gmail.com, 57693@debbugs.gnu.org > > Eli Zaretskii writes: > > > That's for GUI displays only. And it's for strings, not characters. > > To test a single character, you don't need a separate function, IMO, > > you just need to use the test that is the core of that code. > [...] > > If you need to care for TTY frames, that problem has no known solution > > that works for all terminal emulators. So using fancy characters in > > general-purpose Emacs features is a problem that cannot be solved > > programmatically, or at least we don't currently know how to do that. > > Thanks, those are useful clarifications. But could we not just fall > back to the replacement on TTY frames instead? Something like: > > (defun insert-char-safely (ch repl) > "Insert character CH, if it can be displayed; otherwise insert REPL. > On TTY frames, always insert REPL." > (if (not (display-graphic-p)) > (insert repl) > (insert ch) > (unless (font-at (1- (point))) > (delete-char -1) > (insert repl)))) We could, but IME typical uses of fancy characters do not insert them into a buffer, but use them in header-line, overlay strings, and suchlikes.