Subject: bug#56682: Fix the long lines font locking related slowdowns

From: Gregory Heytings <[email-masked]>
Date: Mon, 01 Aug 2022 13:34:09 +0000

>>> You can maybe have that for C-p that follows M->, but wouldn't the 
>>> wait return, with a vengeance, if you insert a single character 
>>> (because then the buffer needs to be re-scanned)?  If so, we've gained 
>>> nothing, really.
>>
>> Fortunately no: the buffer doesn't need to be rescanned, syntax-ppss 
>> caches its result, to avoid having to rescan the whole buffer again and 
>> again.
>
> But the buffer has changed, so the cache is not necessarily valid, 
> right?
>

I didn't look at the internals of syntax-ppss, but I'd guess (and again my 
tests seem to confirm) that it was designed well enough, and doesn't need 
to rescan the whole buffer whenever a single character is inserted.