Subject: Re: bug#57207: 29.0.50; Fontification is slow after e7b5912b23 (Improvements to long lines handling)

From: Gregory Heytings <[email-masked]>
Date: Sat, 20 Aug 2022 23:22:23 +0000

>> That's too late, I think?  How do we ensure after that the update of 
>> the mode-line (in case the hook really wants to change the 
>> restriction)?
>
> Hmmm...  I guess I need to think about this a bit more!
>

Actually, that bug is a symptom of a problem that happens everywhere in 
decode_mode_spec: whenever BEGV and ZV are used, their values could be 
wrong if the calculation happens when locked narrowing is in effect.

One thing I don't understand there is that in some places we use BEGV and 
ZV (namely, case 'i' and case 'I'), and everywhere else we use BUF_BEGV 
(b) and BUF_ZV (b).  These should be equivalent given that b is set to 
current_buffer, but perhaps I'm missing something.

Is it also guaranteed that XBUFFER (w->contents) == current_buffer?  It 
seems that it is, but there is no eassert, so I'm not entirely sure.  (I 
tried to add one and did not see the assertion fail.)