[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#64329: 29.0.92; treesit/fill-paragraph syntax highlighting problem
From: |
Eli Zaretskii |
Subject: |
bug#64329: 29.0.92; treesit/fill-paragraph syntax highlighting problem |
Date: |
Thu, 29 Jun 2023 08:10:05 +0300 |
> From: Yuan Fu <casouri@gmail.com>
> Date: Wed, 28 Jun 2023 14:23:41 -0700
> Cc: 64329@debbugs.gnu.org,
> Eli Zaretskii <eliz@gnu.org>
>
> The culprit is the subst-char-in-region function used by the filling
> function. It has a branch:
>
> if (xxx)
> {
> replace_range (pos, pos + 1, string, ...);
> }
> else
> {
> for (i = 0; i < len; i++) *p++ = tostr[i];
> }
>
> I overlooked the else branch and thought subst-char-in-region always calls
> replace_range. replace_range notifies tree-sitter of the change it makes; but
> when subst-char-in-region manually replaces the text in the else branch,
> those edits are not notified to tree-sitter.
>
> Please see the attached patch. Eli, is it more preferable to add a subroutine
> in insdel.c that does what "for (i = 0; i < len; i++) *p++ = tostr[I];” does,
> plus calling treesit_record_change, and make subst-char-in-region call that
> subroutine? (This way editfns.c don’t need to include treesit.h and call
> treesit_record_change itself.)
I'd prefer to install the patch you show on the emacs-29 branch, and
then clean it up with a subroutine in insdel.c on master.
We could also leave this on master without adding a subroutine:
casefiddle.c already does something similar, so it's not like
including treesit.h is known to cause trouble or something.
Thanks.