bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character

Eli Zaretskii <[email protected]>
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
> From: Juri Linkov <[email protected]>
> Cc: Sean Whitton <[email protected]>,  [email protected],  Eli
>  Zaretskii <[email protected]>,  [email protected],  [email protected]
> Date: Wed, 19 Aug 2026 19:53:26 +0300
> 
> >>>> I'm very sorry to reopen it, but we still have the same problem
> >>>> in the emacs-31 release branch.  For example, try in c-ts-mode to
> >>>> uncomment a comment, and it leaves the trailing */ comment endings.
> >>> 
> >>> I'm not sure this is important enough to block the release, but we can
> >>> at least discuss whether we think there is a possible small,
> >>> non-invasive for the emacs-31 branch.  Yuan, sorry to go back and forth
> >>> so many times here, but do you think there is a way to do it less
> >>> invasively?
> >> 
> >> Leaving emacs-31 unfixed makes c-ts-mode somewhat unusable
> >> since uncommenting is a frequent operation.  If a small fix
> >> for treesit-forward-comment is still unfeasible, then at least
> >> we need to disable the 'comment' thing for c-ts-mode
> >> in the release branch:
> >> 
> >> diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
> >> index 5f064716a89..3efbee6f8a7 100644
> >> --- a/lisp/progmodes/c-ts-mode.el
> >> +++ b/lisp/progmodes/c-ts-mode.el
> >> @@ -1275,8 +1275,7 @@ c-ts-mode--thing-settings
> >>                     "goto_statement"
> >>                     "case_statement")))
> >>     (text ,(regexp-opt '("comment"
> >> -                         "raw_string_literal")))
> >> -    (comment "comment"))
> >> +                         "raw_string_literal"))))
> >>   "`treesit-thing-settings' for both C and C++.")
> >
> > Actually this makes a lot of sense. I don’t think we are missing anything
> > by not using tree-sitter for the comment thing, forward/backward-comment
> > already works perfectly fine without it. We can also add a comment to
> > explain why we leave the comment thing out for c-ts-mode in the release
> > version.
> 
> Eli and Sean, is this change ok to install on the release branch?

I don't mind, but please wait for Sean to respond.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.