emacs-devel
[Top][All Lists]
Advanced

[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: Tue, 30 Aug 2022 14:41:49 +0300

> From: Richard Stallman <rms@gnu.org>
> Cc: emacs-devel@gnu.org
> Date: Tue, 30 Aug 2022 00:12:02 -0400
> 
>   > No, because displaying a non-ASCII character on a text-mode terminal
>   > requires to encode it.
> 
> Maybe the existing mechamisms will insist on encoring it, but I think
> it won't be hard to bypass that step.  The user could specify the
> encoded sequence to send, by putting that sequence in a variable as a
> string or vector.
> 
> Then redisplay simply has to send the sequence of characters
> from the vector, _as if_ they were the result of encoding something.

This is possible technically, but it isn't safe, because figuring out
the correct encoding of the terminal and producing a suitably-encoded
byte sequence is tricky at best, for users to get right.  And this is
going to misfire if the user ever uses a terminal with a different
encoding.

More importantly, we are talking about a fallback feature, used for
characters that fail to display in any other way we know.  What you
suggest is inappropriate for such fallback methods, which must be 110%
safe.

Using a display-table is therefore a much better way of adapting Emacs
to the specific desires of the user in this case.  For starters, the
character codes emitted by the display-table are encoded as usual,
when written to the terminal.

>   > 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?
> 
> With 255 specified, it would not be adequate.  The Linux console handles
> the Greek alphabet, the Russian alphabet, and I am not sure what else.

Then maybe change #x100 to #x530 as the first approximation.

> Using several disjoint ranges could do the job, I suppose,
> if someone can tell me how to determine what those ranges should be.
> 
> Could this be figured out automatically by calling char-displayable-p
> on each character code?

Such a code can be written, and can use char-displayable-p, indeed.

> Up to what number would that loop have to run?

Up to (and including) #x10FFFF.



reply via email to

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