bug#80837: treesit-forward-comment off-by-one issue: overshoots by one character
Yuan Fu <[email protected]>
| Newsgroups | gmane.emacs.bugs |
|---|---|
| Message-ID | <[email protected]> |
> On Aug 18, 2026, at 11:53 AM, Juri Linkov <[email protected]> wrote: > >>> 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++.") > > ;;; Support for FOR_EACH_* macros > 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. Yuan