[Top][All Lists]

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

Re: Display of undisplayable characters: \U01F3A8 instead of diamond

From: Eli Zaretskii
Subject: Re: Display of undisplayable characters: \U01F3A8 instead of diamond
Date: Mon, 29 Aug 2022 16:00:57 +0300

> From: Richard Stallman <rms@gnu.org>
> Cc: emacs-devel@gnu.org
> Date: Sun, 28 Aug 2022 23:36:01 -0400
>   > --8<---------------cut here---------------start------------->8---
>   > (set-char-table-extra-slot glyphless-char-display 0 'thin-space)
>   > --8<---------------cut here---------------end--------------->8---
>   > This shows a single space character.  
> Could a variant of that display a diamond instead of a space?

No, because displaying a non-ASCII character on a text-mode terminal
requires to encode it.  And since the extra-slot of that char-table is
used for fallback display of characters for which the usual encoding
doesn't work, nothing but ASCII characters can be safely put there.

But you can have a different ASCII character there, like '*', for
example (it will be displayed with a special face, to make it stand

> but what is so bad about sending a glyph that the terminal can't
> display?  What bad results does it cause?

It could mess up the display, because sending commands to the terminal
driver also involves sequences of unprintable bytes.  We don't send
unprintable characters to the terminal for that reason.

> Or how about fixing it by sending an official code for that diamond glyph?

I don't see a reason to have a general-purpose feature in Emacs
display like that.  For starters, I don't think terminals in general
use the U+FFFD "diamond" in such cases.  It sounds like your personal
preference, specifically for the Linux console.  In which case I can
suggest a simple customization to do this in your Emacs sessions.  Put
the following into your init file:

  (defun setup-diamonds ()
    (let ((table (or standard-display-table
                     (setq standard-display-table (make-display-table)))))
      (set-char-table-range table '(#x100 . #x10FFFF)
                             (list (make-glyph-code #xFFFD 'homoglyph))))))

This arranges for all the characters beyond 255 to be displayed as the
diamond with a special face.  (You can, of course, adjust the range of
characters for which this is done according to your needs, or have
several disjoint ranges instead of just one.)

Would that be good enough for your use patterns?

reply via email to

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