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

From: Gregory Heytings <[email-masked]>
Date: Thu, 09 Feb 2023 14:39:39 +0000

Thanks for your feedback.

>
> There's one thing I cannot seem to be able to find in the documentation 
> you added: how can a Lisp program know that it is being run under a 
> "labeled narrowing",
>

A function/macro to check that could indeed be added, its body would be:

(save-restriction (widen) (buffer-narrowed-p))

>
> and in particular what is the label? Without knowing that, how can Lisp 
> programs adapt their behavior to this special kind of narrowing, or even 
> just break out of it using without-narrowing?
>

That information should be given in the docstring of the function that 
creates that narrowing.  It is now present in the docstrings of the three 
hooks where it is used:

pre-command-hook and post-command-hook: ... these functions are called as 
if they were in a `with-narrowing' form, with a 
`long-line-optimizations-in-command-hooks' label ...

fontification-functions: ... these functions are called as if they were in 
a `with-narrowing' form, with a 
`long-line-optimizations-in-fontification-functions' label ...