Subject: Fontification takes a long time when an equation contains a double prime

From: Najib Idrissi-Kaïtouni<[email-masked]>
Date: Wed, 8 Jul 2020 14:31:35 +0200

Dear Auctex developers,

Whenever an equation contains a "double prime" '', and if the equation 
is very far down in a long document, it appears that fontification takes 
a very long time. This is not very apparent for short documents, but I 
am currently editing a 6000 lines / 360k character long document. Any 
keystroke resulting in a change in the affected equation, or even just 
displaying that part of the buffer, makes Emacs grind to a halt (on my 
machine, it can take 10-15 seconds to process, during which Emacs is 
completely unresponsive, including not responding to C-g).

I would guess that Auctex thinks '' is the end of a quote and is looking 
for the (nonexistent) double backtick `` that would be the beginning of 
it. I tried to get a backtrace with gdb and it's not exactly clear which 
precise function is to blame, but it was always as part of the 
fontification. As a test, I filled a buffer with some lipsum and put an 
equation at the bottom. Without '' everything is fine, as soon as there 
is a '' in the equation things start to noticeably slow down.

I am currently using the latest version, 12.2.4, and Emacs 27.0.91. The 
behavior is fairly recent, although I couldn't say if it started with 
this release precisely, it may have started more than a week ago.

Thanks.
Najib Idrissi