Subject: bug#41522: 26.3; Narrowing can prevent syntax propertization

From: Dmitry Gutov <[email-masked]>
Date: Mon, 25 May 2020 18:04:01 +0300

Hi!

On 25.05.2020 11:42, Ikumi Keita wrote:
> In a similar way, if a lisp function goes to the point where syntax
> propertization has not yet took place, makes narrowing and calls some
> syntax-aware function which sets `syntax-propertize--done' to a value
> inside the narrowing, a large portion of the buffer can be left without
> suitable `syntax-table' property. This can lead to incorrect result
> for not only font-lock but also syntax-aware functions such as
> `forward-comment'.

Our current stance on the matter is that, in the simple case, code 
should call syntax-ppss from "widened" state. And the code which doesn't 
should be fixed. Or if it really need to do that (for some reason), it 
should take care to handle any undesired sife-effects itself.

See the definition of syntax-ppss-wide, which contains caches for both 
narrowed and "wide" syntax states.