Subject: bug#77381: [PATCH] extend tex--prettify-symbols-alist

From: Eli Zaretskii <[email-masked]>
Date: Sun, 30 Mar 2025 17:33:19 +0300

> From: "Paul D. Nelson" <[email-masked]>
> Cc: [email-masked]
> Date: Sun, 30 Mar 2025 15:27:05 +0200
> 
> >> This patch adds symbols to tex--prettify-symbols-alist.  The new symbols
> >> include math symbols, accented characters, quotes and fractions.
> >
> > Thanks, but did you make sure this won't cause any regressions and/or
> > annoyances if the user's machine doesn't have the requisite fonts
> > installed?
> 
> If I understand correctly, the concern is that if a font for a character
> in the alist is unavailable, Emacs will display a white square.  For
> instance, on my machine (running macOS), adding
> 
>   (add-to-list 'prettify-symbols-alist '("\\satellite" . #x1F6F0))
> 
> makes "\satellite" look like a white square when prettify-symbols-mode
> is active.

That's what I was afraid of.

> So the question is whether the symbols introduced by this patch are more
> likely to cause such issues than those already in
> tex--prettify-symbols-alist.
> 
> Using (set-face-attribute 'default nil :font "...") and C-u C-x =, I
> checked that DejaVu Sans supplies all the new symbols except those
> attached to
> 
>   \bigsqcup, \biguplus, "\ "
> 
> which are found in DejaVu Math TeX Gyre.
> 
> I checked that Arial has all the new symbols except those attached to
> 
> - \frac{1}{7}, \frac{1}{9}, \frac{1}{10}, \Game, found in DejaVu Sans
>   (like for \daleth).
> 
> - \Finv, found in American Typewriter (like for \cdot), and
> 
> - \bigodot, \bigoplus, \bigotimes, \bigsqcup, \biguplus, \iiiint, found
>   in DejaVu Math TeX Gyre.
> 
> Helvetica lacks many of the newly added and already present symbols.
> 
> This was a spot check, but it suggests that the new entries have similar
> fallback behavior to existing ones, with the exception of a few
> characters that depend on DejaVu Math TeX Gyre.
> 
> Perhaps the simplest way to avoid regressions would be to drop those
> less well-supported symbols?

Ideally, we should only add those which can be displayed.  The
function char-displayable-p should be able to tell.  Would it be
possible to change the code such that only the symbols that pass that
test are added?

Thanks.