Subject: 13.0.11; Dollars in distinct comments trigger math mode highlighting in text in-between

From: jfbu <[email-masked]>
Date: Tue, 11 May 2021 21:17:23 +0200

Consider the following file:

% -*- coding: utf-8; mode: latex; -*-
% $
\def\foo_with_underscore{}
%
%
\def\foo_bar_foo_bar{}
% $
%

The presence of the $ sign in comments trigger math mode highlighting in between, as demonstrated in the attached screenshot

This happens in 13.0.11 (installed via Elpa) but did not happen at 12.2.0 and in fact I sticked with 12.2.0 for a long period because I had it still by accident on another computer where I had started lots of tex coding using very often $ in comments for some special reasons (it had another catcode) and when on my laptop which was with auctex from git I realized I could not work at all anymore because of this highlighting problem I simply rsync'ed from my other computer to my laptop as I had no time to devote to this issue. I thought perhaps the problem was with doctex-mode but today I see I can trigger it in latex-mode.

git bisect indicates first bad commit is

commit 6654955216a42936b87f76dc346aad829b1d52fb
Date:   Wed Jun 3 01:44:32 2020 +0900

    Use search-based fontification for $...$ (bug#33139)

Reading the commit message, I see there was extensive discussion and the change seems to have been discussed in depth and well-motivated. I wonder if you can confirm that you see the same at your locale as me.

Possibly relevant to this in my config are (but I did not try to change them)

 '(font-latex-fontify-script (quote multi-level))

 '(texmathp-search-n-paragraphs 0)

For the latter I dimly recall it was an old issue I had in doctex with highlighting too but I don't recall the details and it might be something else whatsoever. (I think last week I did try removing this to see if it affected the present issue but it did not).