GNU bug report logs - #42267
Fontification takes a long time when an equation contains a double prime

Previous Next

Package: auctex;

Reported by: Najib Idrissi-Kaïtouni <najib.idrissi.kaitouni <at> gmail.com>

Date: Wed, 8 Jul 2020 14:47:02 UTC

Severity: normal

Tags: fixed

Done: Ikumi Keita <ikumi <at> ikumi.que.jp>

Bug is archived. No further changes may be made.

Full log


Message #20 received at 42267 <at> debbugs.gnu.org (full text, mbox):

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: Najib Idrissi-Kaïtouni <najib.idrissi.kaitouni <at> gmail.com>
Cc: 42267 <at> debbugs.gnu.org
Subject: Re: bug#42267: Fontification takes a long time when an equation
 contains a double prime
Date: Fri, 10 Jul 2020 16:53:39 +0900
[Message part 1 (text/plain, inline)]
Hi Najib and all,

>>>>> Najib Idrissi-Kaïtouni <najib.idrissi.kaitouni <at> gmail.com> writes:
> Yes, this is much, much better with this patch. I don't experience any
> noticeable slowdown anymore, whether in the test file or in my "real
> world" file. Thanks!

Thanks for confirmation. We'll fix the problem soon.

To AUCTeX developers:
I propose to install the attached fix. Any comments and suggestions are
welcome.

[Analysis]
The backgrounds of the problem are the following two:
1. When there is a closing quote (or double prime) '' without matching
   opening quote `` before it, current
   `font-latex-extend-region-backwards-quotation' ends up to decrease
   `font-lock-beg' by 5000 (=default value of
   `font-latex-multiline-boundary') and returns t.
2. Previously, font-latex-extend-region-backwards-* functions were
   stored in `font-latex-extend-region-functions' and called just once
   per fontify operation. However, now they are in
   `font-lock-extend-region-functions' and can be called repeatedly in
   `font-lock-default-fontify-region', until all of them return nil.

Therefore, when there is math expression like $f''(x)=x^{3}$, current
f-l-e-r-b-q repeatedly decreases `font-lock-beg' so that the font lock
region begins with BOB eventually. Thus every key stroke forces to
re-fontify all the region from top of the buffer. This is the reason of
the apparent slowdown in a large buffer.

I think the behavior of the above item 1 is a bug. When f-l-e-r-b-q
cannot find a matching opening quote, it should just give up to extend
the region anymore.

Regards,
Ikumi Keita

[0001-Don-t-extend-font-lock-region-too-much-bug-42267.patch (text/x-diff, attachment)]

This bug report was last modified 5 years and 6 days ago.

Previous Next


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