Subject: Re: bug#35140: 12.1; Scan errors in doctex mode with ^^A-comments after braces

From: Stefan Monnier <[email-masked]>
Date: Wed, 02 Mar 2022 09:00:16 -0500

>> Thus I'm inclined to an idea just to fontify "^^A" type comments with
>> normal comment face, not bothering with changing its syntax. Attached is
>> a patch that implements this idea.
>>
>> What do others think about this?
>
> I don't think AUCTeX suffers if the syntax after "^^A" isn't change so
> we could do it.  One other idea would be to raise this issue also on
> Emacs devel list since Emacs has the same issue as well or ping Stefan
> M. to have a look at this thread before we make a final decision.  What
> do you think?

I'm not sufficiently informed about DocTeX to know what's the right
thing to do here.  Changing the code so it only changes the face but
without messing with syntax tables would definitely be simpler.

But one thing catches my attention.  If having the `}` marked as an
end-of-comment "fails scanning for balanced {...} pairs" with the
current setup, wouldn't the same kind of problem appear with

    # \begin{macro}^^A Funny, eh? (

if the `^^A.*` part isn't marked in the syntax as separate?

In which operation does the "fails scanning for balanced {...} pairs"
happen?

        Stefan

PS: It would be nicer if AUCTeX could just use the tex-mode.el code
rather the copy&paste it.