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 13:56:24 +0200 Message-ID: <83cz67yyon.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> <83lekvz605.fsf@gnu.org> <871qmnky3b.fsf@localhost> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="1427"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 57693@debbugs.gnu.org, stefankangas@gmail.com, yantar92@gmail.com To: Ihor Radchenko Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 18 12:57:19 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 1pTLq9-000AdT-TS for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 18 Feb 2023 12:57:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pTLpw-00078T-EG; Sat, 18 Feb 2023 06:57:04 -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 1pTLpu-00078E-Ki for bug-gnu-emacs@gnu.org; Sat, 18 Feb 2023 06:57:02 -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 1pTLpu-00060h-CK for bug-gnu-emacs@gnu.org; Sat, 18 Feb 2023 06:57:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pTLpu-0001eK-07 for bug-gnu-emacs@gnu.org; Sat, 18 Feb 2023 06:57: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 11:57:01 +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.16767213916281 (code B ref 57693); Sat, 18 Feb 2023 11:57:01 +0000 Original-Received: (at 57693) by debbugs.gnu.org; 18 Feb 2023 11:56:31 +0000 Original-Received: from localhost ([127.0.0.1]:42707 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pTLpO-0001dF-OF for submit@debbugs.gnu.org; Sat, 18 Feb 2023 06:56:31 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:48336) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pTLpM-0001cy-MS for 57693@debbugs.gnu.org; Sat, 18 Feb 2023 06:56:29 -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 1pTLpH-0005kf-2r; Sat, 18 Feb 2023 06:56:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=fzbNZtiEEUQj/r9hB6SEOMecB72Y3TFn7C/0S64Bsc0=; b=HXV8Dmva41s54qTD53IK Q3TLs/4bvyFvOJkma8Fwq+qWk/33CGfxDPki31l9v1jsrYWGRn+6C/acIgTZUidGZVwsmOy9atmcE W5wxI6eMF+CR31EBf2YivIeBszKifHBMBAX0e4GMqRWGMhm4Jiy4sDPCPajY0FqVqjrZw1tSu+Sza +t2Wra2iwdnvUj2NNuQScK6bR21XeAK4JyGLqSxbd70BZdZKYH5U+aP0LCldarbxXiQA1bv5yDWAT 0NStlYdsywI/5mKIHN+xosRDWW96+2oIcg5mYX+lODTs6KxcC79FNJ1pcY71kBWvHyxPNFCW8rdN5 1tHpwLeuIN9/Ww==; 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 1pTLpG-0001Ei-6o; Sat, 18 Feb 2023 06:56:22 -0500 In-Reply-To: <871qmnky3b.fsf@localhost> (message from Ihor Radchenko on Sat, 18 Feb 2023 11:32:56 +0000) 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:255960 Archived-At: > From: Ihor Radchenko > Cc: Stefan Kangas , yantar92@gmail.com, > 57693@debbugs.gnu.org > Date: Sat, 18 Feb 2023 11:32:56 +0000 > > Eli Zaretskii writes: > > >> (defun insert-char-safely (ch repl) > >> "Insert character CH, if it can be displayed; otherwise insert REPL. > >> On TTY frames, always insert REPL." > >> (if (not (display-graphic-p)) > >> (insert repl) > >> (insert ch) > >> (unless (font-at (1- (point))) > >> (delete-char -1) > >> (insert repl)))) > > > > We could, but IME typical uses of fancy characters do not insert them > > into a buffer, but use them in header-line, overlay strings, and > > suchlikes. > > `font-at' accepts optional third argument STRING. > For example, (font-at 0 nil "🧠a") My comment was because Stefan suggested a function that inserts a character into a buffer, not because font-at by default reports about a character at point. > As an alternative thought, may Emacs display engine accept a text > property like 'display-alternative to display some fallback > character/string if some parts of the displayed text cannot be > displayed? We already have something like that: see glyphless-char-display and glyphless-char-display-mode. The problem is that (a) on GUI displays the replacement will be displayed in a box; (b) the replacement must be an ASCII character; and (c) the char-table we use for that is global, i.e. it affects the entire session. But if someone wants a more flexible feature which lifts some of those restrictions, that's the place to start nonetheless.