Subject: Re: bug#56682: feature/improved-locked-narrowing 9dee6df39c: Reworked locked narrowing.

From: Gregory Heytings <[email-masked]>
Date: Fri, 30 Dec 2022 17:25:58 +0000

>
> I think it's quite urgent (it's all too easy to forget: better a subpar 
> entry than no entry at all).
>

I'll do that very soon.

>
> Hmm... I understand that part but that doesn't tell me how I (the coder) 
> or the function can find out which tag to use :-(
>

You have to know where your function is called and by which caller a lock 
was placed.  Currently there are three such tags (and I don't expect more 
tags in core): fontification-functions, pre-command-hook and 
post-command-hook.

>
> Looking more at the code, I have another question: why is 
> `narrowing_locks` a global alist indexed by buffers, instead of being a 
> buffer-local variable?
>

For efficiency reasons.  If it were a buffer-local variable, 
reset_outermost_narrowings, which is called by redisplay_internal, would 
have to consider all buffers, which would become unnecessarily slow with 
many (say 1000) buffers.  With a global alist, only the (few) buffers in 
which narrowing locks are actually in effect are considered.