all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Yuan Fu <casouri@gmail.com>
Cc: brownts@troybrown.dev, 64329@debbugs.gnu.org
Subject: bug#64329: 29.0.92; treesit/fill-paragraph syntax highlighting problem
Date: Thu, 29 Jun 2023 08:10:05 +0300	[thread overview]
Message-ID: <83ttuqua4y.fsf@gnu.org> (raw)
In-Reply-To: <3031A934-37EC-497D-8A48-ECE7FD703B31@gmail.com> (message from Yuan Fu on Wed, 28 Jun 2023 14:23:41 -0700)

> 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.





      parent reply	other threads:[~2023-06-29  5:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-28 16:46 bug#64329: 29.0.92; treesit/fill-paragraph syntax highlighting problem Troy Brown
2023-06-28 21:23 ` Yuan Fu
2023-06-29  0:17   ` Yuan Fu
2023-06-29  5:22     ` Eli Zaretskii
2023-06-29 18:17       ` Yuan Fu
2023-06-29  5:10   ` Eli Zaretskii [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83ttuqua4y.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=64329@debbugs.gnu.org \
    --cc=brownts@troybrown.dev \
    --cc=casouri@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.