all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Ihor Radchenko <yantar92@posteo.net>
Cc: 57693@debbugs.gnu.org, stefankangas@gmail.com, yantar92@gmail.com
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	[thread overview]
Message-ID: <83cz67yyon.fsf@gnu.org> (raw)
In-Reply-To: <871qmnky3b.fsf@localhost> (message from Ihor Radchenko on Sat, 18 Feb 2023 11:32:56 +0000)

> From: Ihor Radchenko <yantar92@posteo.net>
> Cc: Stefan Kangas <stefankangas@gmail.com>, yantar92@gmail.com,
>  57693@debbugs.gnu.org
> Date: Sat, 18 Feb 2023 11:32:56 +0000
> 
> Eli Zaretskii <eliz@gnu.org> 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.





  reply	other threads:[~2023-02-18 11:56 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-09 13:25 bug#57693: 29.0.50; Is there a more reliable version of `char-displayable-p'? Ihor Radchenko
2022-09-09 13:38 ` Eli Zaretskii
2022-09-09 22:25   ` Stefan Kangas
2022-09-10  6:01     ` Eli Zaretskii
2022-09-10  6:06       ` Ihor Radchenko
2022-09-10  6:35         ` Eli Zaretskii
2022-09-10  6:44           ` Ihor Radchenko
2022-09-10  4:48   ` Ihor Radchenko
2022-09-10  6:24     ` Eli Zaretskii
2022-09-10  6:37       ` Ihor Radchenko
2022-09-10  7:56         ` Eli Zaretskii
2022-09-10  8:17           ` Ihor Radchenko
2022-09-10  8:42             ` Eli Zaretskii
2022-09-11  9:31               ` Ihor Radchenko
2022-09-11  9:43                 ` Eli Zaretskii
2022-09-11 10:07                   ` Eli Zaretskii
2022-09-12  5:46                     ` Ihor Radchenko
2022-09-12 11:15                       ` Eli Zaretskii
2022-09-13  1:44                         ` Ihor Radchenko
2022-09-13 11:19                           ` Eli Zaretskii
2022-09-14  1:52                             ` Ihor Radchenko
2022-09-14  2:43                               ` Eli Zaretskii
2023-02-17 19:18                       ` Stefan Kangas
2023-02-17 19:29                         ` Eli Zaretskii
2023-02-17 22:31                           ` Stefan Kangas
2023-02-18  6:56                             ` Eli Zaretskii
2023-02-18  9:00                               ` Stefan Kangas
2023-02-18  9:18                                 ` Eli Zaretskii
2023-02-18 11:32                                   ` Ihor Radchenko
2023-02-18 11:56                                     ` Eli Zaretskii [this message]
2023-02-19 11:31                                       ` Ihor Radchenko
2023-02-19 11:55                                         ` Eli Zaretskii
2023-02-19 12:08                                           ` Ihor Radchenko
2023-02-19 12:23                                             ` Eli Zaretskii
2023-02-19 14:19                                               ` Ihor Radchenko
2023-02-19 15:02                                                 ` Eli Zaretskii
2023-02-18 11:35                               ` Ihor Radchenko
2023-02-18 12:00                                 ` Eli Zaretskii
2022-09-12  5:24                   ` Ihor Radchenko
2022-09-09 13:46 ` Robert Pluim
2022-09-09 22:25   ` Stefan Kangas
2022-09-10  4:56     ` Ihor Radchenko
2022-09-10  6:02     ` Eli Zaretskii
2022-09-10  4:53   ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83cz67yyon.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=57693@debbugs.gnu.org \
    --cc=stefankangas@gmail.com \
    --cc=yantar92@gmail.com \
    --cc=yantar92@posteo.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.