Subject: Re: bug#64321: 29.0.92; Tree-Sitter/which-function Narrow/Widen causes modified buffer

From: Eli Zaretskii <[email-masked]>
Date: Wed, 28 Jun 2023 15:01:07 +0300

> From: Yuan Fu <[email-masked]>
> Date: Tue, 27 Jun 2023 21:04:22 -0700
> Cc: [email-masked],
>  Eli Zaretskii <[email-masked]>
> 
> Thanks for the backtrace, it’s very helpful.
> 
> Narrowing and widening are transparent to tree-sitter, so when the buffer widens, from tree-sitter’s POV, text are added to the buffer. Which-func calling the tree-sitter current-defund function ultimately leads to tree-sitter calling treesit—font-lock-notifier which puts text properties on the “added” portion of the buffer, which changed the modified status.
> 
> treesit—font-lock-notifier should put text properties without changing modified status, like what jit-lock does. This patch should fix it.

Thanks.  If this solves the problem, please install in the emacs-29
release branch.