GNU bug report logs -
#72489
29.4.50; forward-comment not working as expected in toml-ts-mode
Previous Next
Reported by: Yang Yingchao <yang.yingchao <at> qq.com>
Date: Tue, 6 Aug 2024 06:08:01 UTC
Severity: normal
Found in version 29.4.50
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 72489 in the body.
You can then email your comments to 72489 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#72489
; Package
emacs
.
(Tue, 06 Aug 2024 06:08:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Yang Yingchao <yang.yingchao <at> qq.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Tue, 06 Aug 2024 06:08:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Steps to reproduce:
1. Open a new buffer in `toml-ts-mode`.
2. Insert the following simple snippets:
```
# (forward-comment 1)
# [[keyboard.bindings]]
# chars = "a"
# key = "Tab"
# mods = "Alt"
```
3. Move the cursor to the first line and call `eval-last-sexp`.
This should move the cursor to the beginning of the line "chars = a", but actually it moves the cursor to the end of the whole block.
This might be an issue with `toml-ts-mode--syntax-table`.
Making a change in https://github.com/emacs-mirror/emacs/blob/e993e479c324bb720bca3f1cf194e55e32f01ccd/lisp/textmodes/toml-ts-mode.el#L53 can fix this issue:
```
- (modify-syntax-entry ?\n "> b" table)
+ (modify-syntax-entry ?\n ">" table)
```
Regards
yang
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#72489
; Package
emacs
.
(Tue, 06 Aug 2024 11:52:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 72489 <at> debbugs.gnu.org (full text, mbox):
> Date: Tue, 06 Aug 2024 13:57:28 +0800
> From: Yang Yingchao via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>
>
>
> Steps to reproduce:
>
> 1. Open a new buffer in `toml-ts-mode`.
> 2. Insert the following simple snippets:
> ```
> # (forward-comment 1)
> # [[keyboard.bindings]]
> # chars = "a"
> # key = "Tab"
> # mods = "Alt"
> ```
> 3. Move the cursor to the first line and call `eval-last-sexp`.
>
> This should move the cursor to the beginning of the line "chars = a", but actually it moves the cursor to the end of the whole block.
>
> This might be an issue with `toml-ts-mode--syntax-table`.
>
> Making a change in https://github.com/emacs-mirror/emacs/blob/e993e479c324bb720bca3f1cf194e55e32f01ccd/lisp/textmodes/toml-ts-mode.el#L53 can fix this issue:
>
> ```
> - (modify-syntax-entry ?\n "> b" table)
> + (modify-syntax-entry ?\n ">" table)
> ```
Thanks.
Jostein, could you please look into this?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#72489
; Package
emacs
.
(Tue, 06 Aug 2024 13:07:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 72489 <at> debbugs.gnu.org (full text, mbox):
> On 6 Aug 2024, at 13:50, Eli Zaretskii <eliz <at> gnu.org> wrote:
>
>> Date: Tue, 06 Aug 2024 13:57:28 +0800
>> From: Yang Yingchao via "Bug reports for GNU Emacs,
>> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>>
>>
>>
>> Steps to reproduce:
>>
>> 1. Open a new buffer in `toml-ts-mode`.
>> 2. Insert the following simple snippets:
>> ```
>> # (forward-comment 1)
>> # [[keyboard.bindings]]
>> # chars = "a"
>> # key = "Tab"
>> # mods = "Alt"
>> ```
>> 3. Move the cursor to the first line and call `eval-last-sexp`.
>>
>> This should move the cursor to the beginning of the line "chars = a", but actually it moves the cursor to the end of the whole block.
>>
>> This might be an issue with `toml-ts-mode--syntax-table`.
>>
>> Making a change in https://github.com/emacs-mirror/emacs/blob/e993e479c324bb720bca3f1cf194e55e32f01ccd/lisp/textmodes/toml-ts-mode.el#L53 can fix this issue:
>>
>> ```
>> - (modify-syntax-entry ?\n "> b" table)
>> + (modify-syntax-entry ?\n ">" table)
>> ```
>
> Thanks.
>
> Jostein, could you please look into this?
Hey there. Let me see if I can help.
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?
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.
--
Jostein
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#72489
; Package
emacs
.
(Tue, 06 Aug 2024 13:07:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#72489
; Package
emacs
.
(Wed, 07 Aug 2024 01:10:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 72489 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
> 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*
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#72489
; Package
emacs
.
(Thu, 15 Aug 2024 10:12:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 72489 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
> On 7 Aug 2024, at 03:02, Yang Yingchao <yang.yingchao <at> qq.com> wrote:
>
> 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*
I've recompiled from scratch and confirm this indeed fixes all issues mentioned.
Eli: Feel free to apply the supplied patch. I still don't have commit access :)
https://github.com/emacs-mirror/emacs/blob/e993e479c324bb720bca3f1cf194e55e32f01ccd/lisp/textmodes/toml-ts-mode.el#L53
> ```
> - (modify-syntax-entry ?\n "> b" table)
> + (modify-syntax-entry ?\n ">" table)
> ```
[Message part 2 (text/html, inline)]
Reply sent
to
Eli Zaretskii <eliz <at> gnu.org>
:
You have taken responsibility.
(Sat, 17 Aug 2024 09:32:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Yang Yingchao <yang.yingchao <at> qq.com>
:
bug acknowledged by developer.
(Sat, 17 Aug 2024 09:32:02 GMT)
Full text and
rfc822 format available.
Message #25 received at 72489-done <at> debbugs.gnu.org (full text, mbox):
> From: Jostein Kjønigsen <jostein <at> secure.kjonigsen.net>
> Date: Thu, 15 Aug 2024 12:10:46 +0200
> Cc: Eli Zaretskii <eliz <at> gnu.org>,
> "Mr. Jostein Kjønigsen" <jostein <at> kjonigsen.net>,
> 72489 <at> debbugs.gnu.org
>
> On 7 Aug 2024, at 03:02, Yang Yingchao <yang.yingchao <at> qq.com> wrote:
>
> 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*
>
> I've recompiled from scratch and confirm this indeed fixes all issues mentioned.
>
> Eli: Feel free to apply the supplied patch. I still don't have commit access :)
>
> https://github.com/emacs-mirror/emacs/blob/e993e479c324bb720bca3f1cf194e55e32f01ccd/lisp/textmodes/toml-ts-mode.el#L53
>
>
> ```
> - (modify-syntax-entry ?\n "> b" table)
> + (modify-syntax-entry ?\n ">" table)
> ```
Thanks, installed on the emacs-30 branch, and closing the bug.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 14 Sep 2024 11:24:15 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 5 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.