Subject: bug#72489: 29.4.50; forward-comment not working as expected in toml-ts-mode

From: Yang Yingchao <[email-masked]>
Date: Wed, 07 Aug 2024 09:02:31 +0800

> Just to be clear I understand the issue and how to reproduce it:
>
> 1. you create an empty buffer and activate toml-ts-mode
> 2. you paste in the supplied text, which is all comments according to TOML syntax
> 3. first line is actually a commented out emacs-lisp command.
> 4. you use (eval-last-sexp) to invoke the command emacs-lisp (forward-comment 1)
>
> And once you do that, the expected outcome would be to jump to next comment-line (ie each commented line is considered its own comment-block)?
>
> I ask, because if I do that, I get an *error* about reaching the end of file, so it seems like
> whatever I'm doing I'm getting slightly different results than you are. Applying the suggested fix
> does not seem to change behaviour either?

I think the error in your case also proves the misbehavior of forward-comment, and it breaks `uncomment-region' in my case. And with the suggested fix applied, and then recompile/evaluate, `uncomment-region' works as expected.

> Yang: Have you loaded/compiled/provided the toml typescript-grammar before using this mode?
>
> The *-ts-modes depends on external grammar in order to properly initialize the major-mode and provide correct highlighting and indentation.

I only have the required shared libraries (libtree-sitter.so & libtree-sitter-toml.so) installed. This should be enough, right? At least `treesit-explore-mode' works fine in toml buffer.

Regards,

-- *Yang Yingchao*