GNU bug report logs - #64329
29.0.92; treesit/fill-paragraph syntax highlighting problem

Previous Next

Package: emacs;

Reported by: Troy Brown <brownts <at> troybrown.dev>

Date: Wed, 28 Jun 2023 16:47:01 UTC

Severity: normal

Found in version 29.0.92

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 64329 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Yuan Fu <casouri <at> gmail.com>
Cc: brownts <at> troybrown.dev, 64329 <at> debbugs.gnu.org
Subject: Re: bug#64329: 29.0.92; treesit/fill-paragraph syntax highlighting
 problem
Date: Thu, 29 Jun 2023 08:10:05 +0300
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Wed, 28 Jun 2023 14:23:41 -0700
> Cc: 64329 <at> debbugs.gnu.org,
>  Eli Zaretskii <eliz <at> 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.




This bug report was last modified 1 year and 332 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.