From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.bugs Subject: bug#57693: 29.0.50; Is there a more reliable version of `char-displayable-p'? Date: Sun, 11 Sep 2022 17:31:06 +0800 Message-ID: <87v8puw945.fsf@localhost> 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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27387"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 57693@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 11 11:31:15 2022 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 1oXJJ4-0006yZ-Iv for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 11 Sep 2022 11:31:14 +0200 Original-Received: from localhost ([::1]:54504 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oXJJ2-0005IF-UK for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 11 Sep 2022 05:31:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52226) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oXJIt-0005Hr-77 for bug-gnu-emacs@gnu.org; Sun, 11 Sep 2022 05:31:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52029) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oXJIs-0002B4-TK for bug-gnu-emacs@gnu.org; Sun, 11 Sep 2022 05:31:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oXJIs-0006Pd-Ej for bug-gnu-emacs@gnu.org; Sun, 11 Sep 2022 05:31:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Ihor Radchenko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 11 Sep 2022 09:31: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.166288862424590 (code B ref 57693); Sun, 11 Sep 2022 09:31:02 +0000 Original-Received: (at 57693) by debbugs.gnu.org; 11 Sep 2022 09:30:24 +0000 Original-Received: from localhost ([127.0.0.1]:40727 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oXJIE-0006OW-V2 for submit@debbugs.gnu.org; Sun, 11 Sep 2022 05:30:23 -0400 Original-Received: from mail-pl1-f177.google.com ([209.85.214.177]:35581) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oXJIA-0006O9-3M for 57693@debbugs.gnu.org; Sun, 11 Sep 2022 05:30:22 -0400 Original-Received: by mail-pl1-f177.google.com with SMTP id t3so5861181ply.2 for <57693@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) Original-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) In-Reply-To: <831qsjboy0.fsf@gnu.org> 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" Xref: news.gmane.io gmane.emacs.bugs:242132 Archived-At: Eli Zaretskii 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