Subject: Re: bug#48365: 13.0.11; Dollars in distinct comments trigger math mode highlighting in text in-between

From: JF <[email-masked]>
Date: Tue, 11 May 2021 22:21:25 +0200

Le 11/05/2021 à 22:06, jfbu a écrit :
> 
> Hi Tassilo,
> 
> Le 11/05/2021 à 21:26, Tassilo Horn a écrit :
>> Hi Jean-Francois,
>>
>>> 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.
>>
>> Yes, I see the problem.  I've pushed a fix which ignores $ in comments
>> just as it already ignored $ in verbatim contexts.
>>
>> Could you please test and report back?
>>
> 
> Yes, it works also in original context, not only in the short test file.
> I realize now that after all I did work for a while with this problem
> and I see one file where I have lots of extra $'s added in comments
> to create pairs of $'s and avoid the propagation, I removed them
> and no ill effect arose, the math highlighting was not applied.
> 
> But... wait...
> 
> Sadly, I now have another problem. Consider this:
> 
> \def\XINT:NE:f:noeval:from:braced:u:p #1#2%
>      {\detokenize{\romannumeral`$XINT_expr_null\expandafter#1}~expanded{{#2}}}%
> 
> There is $ in there, and it triggers math mode highlighting which is a priori fine,
> I can live with that *if I can constrain it to not extend beyond that line*
> 
> In the past I would control it this way:
> 
> \def\XINT:NE:f:noeval:from:braced:u:p #1#2%
>      {\detokenize{\romannumeral`$XINT_expr_null\expandafter#1}~expanded{{#2}}}%$
> 
> (observe the added $ at end of second line after the % comment character)
> 
> With your patch the %$ does not stop the math highlighting !
> 
> This is very problematic to me because that problem can't be solved (as I
> could solve earlier one, especially now that I understand better what causes it,
> via locating extra $'s inside comments)
> by adding a commented out $.
> 
> It basically means I have not way to stop the highlighting from propagating...
> 

not true. I could use another character than % and assign it catcode comment and
use it at end of line

but not that if I am "aguerri" enough for such manoeuvers this might not
be the case of all auctex users and they might do something like
\newcommand\foo{$} and then perhaps they have the same problem as me ?

% -*- coding: utf-8; mode: latex; -*-
%
\def\foo_with_underscore{}
\newcommand\foo{$}% $ does not help here
%
\def\foo_with_underscore{$}% <-- but math highlight will stop here
%
\def\foo_bar_foo_bar{}
%
%

> Jean-François
> 
> 
> 
>> Bye,
>> Tassilo
>>
>>
>>
>> _______________________________________________
>> bug-auctex mailing list
>> [email-masked]
>> https://lists.gnu.org/mailman/listinfo/bug-auctex
>>
> 
> 
> 
> 
> 
> _______________________________________________
> bug-auctex mailing list
> [email-masked]
> https://lists.gnu.org/mailman/listinfo/bug-auctex