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

Juri Linkov <[email protected]>
Newsgroups gmane.emacs.bugs
Organization LINKOV.NET
Message-ID <[email protected]>
>> 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
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.