* bug#68652: 29.1.50; treesit defun commands broken near beginning of function
@ 2024-01-22 4:47 Troy Brown
2024-01-27 10:40 ` Eli Zaretskii
0 siblings, 1 reply; 4+ messages in thread
From: Troy Brown @ 2024-01-22 4:47 UTC (permalink / raw)
To: 68652
I've noticed that "defun" related treesit commands/functions do not
appear to work correctly near the beginning of a function. I've seen
this behavior in multiple languages and believe the problem is an issue
in the treesit.el library. Also, I believe the issue occurs on the
first token of the function definition. The following example uses
c-ts-mode to demonstrate the issue.
--8<---------------cut here---------------start------------->8---
// -*- mode: c-ts -*-
void previous (void);
void next (void);
void previous (void) {
}
void main (void) {
previous();
next();
printf("Hello, world!\n");
}
void next (void) {
}
--8<---------------cut here---------------end--------------->8---
To reproduce the issue, place point between the "o" and "i" of the
"void" return type for the "main" function. When point is at this
location, I've noticed incorrect behavior for the following commands:
M-x treesit-beginning-of-defun RET
Moves point to the beginning of the previous function instead of the
beginning of the current (i.e., "main") function.
M-x treesit-end-of-defun RET
This does not move point, when it should move to the end of the current
function.
I've also noticed functions, such as "treesit-defun-at-point" behave
incorrectly here as well (i.e., returns "nil" instead of the function
definition node).
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#68652: 29.1.50; treesit defun commands broken near beginning of function
2024-01-22 4:47 bug#68652: 29.1.50; treesit defun commands broken near beginning of function Troy Brown
@ 2024-01-27 10:40 ` Eli Zaretskii
2024-01-28 3:55 ` Yuan Fu
0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2024-01-27 10:40 UTC (permalink / raw)
To: Troy Brown, Yuan Fu; +Cc: 68652
> From: Troy Brown <brownts@troybrown.dev>
> Date: Sun, 21 Jan 2024 23:47:08 -0500
>
> I've noticed that "defun" related treesit commands/functions do not
> appear to work correctly near the beginning of a function. I've seen
> this behavior in multiple languages and believe the problem is an issue
> in the treesit.el library. Also, I believe the issue occurs on the
> first token of the function definition. The following example uses
> c-ts-mode to demonstrate the issue.
>
> --8<---------------cut here---------------start------------->8---
> // -*- mode: c-ts -*-
>
> void previous (void);
> void next (void);
>
> void previous (void) {
> }
>
> void main (void) {
> previous();
> next();
> printf("Hello, world!\n");
> }
>
> void next (void) {
> }
> --8<---------------cut here---------------end--------------->8---
>
> To reproduce the issue, place point between the "o" and "i" of the
> "void" return type for the "main" function. When point is at this
> location, I've noticed incorrect behavior for the following commands:
>
> M-x treesit-beginning-of-defun RET
>
> Moves point to the beginning of the previous function instead of the
> beginning of the current (i.e., "main") function.
>
> M-x treesit-end-of-defun RET
>
> This does not move point, when it should move to the end of the current
> function.
>
> I've also noticed functions, such as "treesit-defun-at-point" behave
> incorrectly here as well (i.e., returns "nil" instead of the function
> definition node).
This seems to be already fixed on the master branch, so I think we can
close this bug.
Yuan, any comments?
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#68652: 29.1.50; treesit defun commands broken near beginning of function
2024-01-27 10:40 ` Eli Zaretskii
@ 2024-01-28 3:55 ` Yuan Fu
2024-01-28 6:49 ` Eli Zaretskii
0 siblings, 1 reply; 4+ messages in thread
From: Yuan Fu @ 2024-01-28 3:55 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 68652, Troy Brown
> On Jan 27, 2024, at 2:40 AM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> From: Troy Brown <brownts@troybrown.dev>
>> Date: Sun, 21 Jan 2024 23:47:08 -0500
>>
>> I've noticed that "defun" related treesit commands/functions do not
>> appear to work correctly near the beginning of a function. I've seen
>> this behavior in multiple languages and believe the problem is an issue
>> in the treesit.el library. Also, I believe the issue occurs on the
>> first token of the function definition. The following example uses
>> c-ts-mode to demonstrate the issue.
>>
>> --8<---------------cut here---------------start------------->8---
>> // -*- mode: c-ts -*-
>>
>> void previous (void);
>> void next (void);
>>
>> void previous (void) {
>> }
>>
>> void main (void) {
>> previous();
>> next();
>> printf("Hello, world!\n");
>> }
>>
>> void next (void) {
>> }
>> --8<---------------cut here---------------end--------------->8---
>>
>> To reproduce the issue, place point between the "o" and "i" of the
>> "void" return type for the "main" function. When point is at this
>> location, I've noticed incorrect behavior for the following commands:
>>
>> M-x treesit-beginning-of-defun RET
>>
>> Moves point to the beginning of the previous function instead of the
>> beginning of the current (i.e., "main") function.
>>
>> M-x treesit-end-of-defun RET
>>
>> This does not move point, when it should move to the end of the current
>> function.
>>
>> I've also noticed functions, such as "treesit-defun-at-point" behave
>> incorrectly here as well (i.e., returns "nil" instead of the function
>> definition node).
>
> This seems to be already fixed on the master branch, so I think we can
> close this bug.
>
> Yuan, any comments?
I just tried it and yeah it’s fixed on master. I couldn’t find which commit fixed it though…
Yuan
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#68652: 29.1.50; treesit defun commands broken near beginning of function
2024-01-28 3:55 ` Yuan Fu
@ 2024-01-28 6:49 ` Eli Zaretskii
0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2024-01-28 6:49 UTC (permalink / raw)
To: Yuan Fu; +Cc: 68652-done, brownts
> From: Yuan Fu <casouri@gmail.com>
> Date: Sat, 27 Jan 2024 19:55:52 -0800
> Cc: Troy Brown <brownts@troybrown.dev>,
> 68652@debbugs.gnu.org
>
> > This seems to be already fixed on the master branch, so I think we can
> > close this bug.
> >
> > Yuan, any comments?
>
> I just tried it and yeah it’s fixed on master. I couldn’t find which commit fixed it though…
OK, so I'm now closing this bug.
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-01-28 6:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-22 4:47 bug#68652: 29.1.50; treesit defun commands broken near beginning of function Troy Brown
2024-01-27 10:40 ` Eli Zaretskii
2024-01-28 3:55 ` Yuan Fu
2024-01-28 6:49 ` Eli Zaretskii
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).