bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#57693: 29.0.50; Is there a more reliable version of `char-displayabl


From: Eli Zaretskii
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

> From: Stefan Kangas <stefankangas@gmail.com>
> Date: Sat, 18 Feb 2023 01:00:38 -0800
> Cc: yantar92@gmail.com, 57693@debbugs.gnu.org
> 
> Eli Zaretskii <eliz@gnu.org> 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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]