GNU bug report logs - #78752
31.0.50; New tex-mode prettify-symbols-mode rule causes visual regression

Previous Next

Package: emacs;

Reported by: Tony Zorman <mail <at> tony-zorman.com>

Date: Tue, 10 Jun 2025 17:39:03 UTC

Severity: normal

Found in version 31.0.50

Full log


View this message in rfc822 format

From: Arash Esbati <arash <at> gnu.org>
To: "Paul D. Nelson" <ultrono <at> gmail.com>
Cc: Tony Zorman <mail <at> tony-zorman.com>, 78752 <at> debbugs.gnu.org, Stefan Monnier <monnier <at> iro.umontreal.ca>, Tassilo Horn <tsdh <at> gnu.org>
Subject: bug#78752: 31.0.50; New tex-mode prettify-symbols-mode rule causes visual regression
Date: Wed, 11 Jun 2025 16:11:35 +0200
[Message part 1 (text/plain, inline)]
"Paul D. Nelson" <ultrono <at> gmail.com> writes:

> Tony Zorman <mail <at> tony-zorman.com> writes:
>
>> (this change certainly isn't as bad as the long established
>> replacement of showing '\newline' as LINE SEPARATOR, making it
>> essentially invisible by default).
>
> I guess I haven't run into TeX \newline's often enough to notice this,
> but it's invisible for me, too.  @Tassilo: any thoughts on this one?

I'm not Tassilo, but my suggestion is to remove the entries for '\newline'
and '\ ' from the prettification-list.  Consider this piece of valid
LaTeX-code:

--8<---------------cut here---------------start------------->8---
\_%
\begin{tabular}[t]{p{5cm}l}
  foo\newline bar & baz
\end{tabular}
\_

\_\parbox[t]{5cm}{Term-\\ S.}\_

\_\parbox[t]{5cm}{Term-\\S.}\_
--8<---------------cut here---------------end--------------->8---

which is prettified to this:
[pretty-symbols.png (image/png, inline)]
[Message part 3 (text/plain, inline)]
\newline is effectively gone, and what happens after \\ is also wrong.
I'm not sure, but I think the \parbox examples above show a bug in
`tex--prettify-symbols-compose-p' which should also check if the
character(s) before the currently ignored START is(are) backslashes, and
if yes, how many, and then prettify or not.  AUCTeX has this for this
purpose:

--8<---------------cut here---------------start------------->8---
(defun TeX-escaped-p (&optional pos)
  "Return t if the character at position POS is escaped.
If POS is omitted, examine the character at point.
A character is escaped if it is preceded by an odd number of
escape characters, such as \"\\\" in LaTeX."
  (save-excursion
    (when pos (goto-char pos))
    (not (zerop (mod (skip-chars-backward (regexp-quote TeX-esc)) 2)))))
--8<---------------cut here---------------end--------------->8---

I'm Cc'ing Stefan M. who maintains tex-mode.el.

Best, Arash

This bug report was last modified 7 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.