GNU bug report logs -
#60623
30.0.50; Add forward-sentence with tree sitter support
Previous Next
Reported by: Theodor Thornhill <theo <at> thornhill.no>
Date: Sat, 7 Jan 2023 11:55:02 UTC
Severity: normal
Found in version 30.0.50
Fixed in version 30.1
Done: Theodor Thornhill <theo <at> thornhill.no>
Bug is archived. No further changes may be made.
Full log
Message #20 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Daniel Martín <mardani29 <at> yahoo.es> writes:
> Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife
> of text editors" <bug-gnu-emacs <at> gnu.org> writes:
>
>> Hi all!
>>
>> This patch tweaks the forward-sentence function to be usable with
>> tree-sitter.
>>
>> It follows the same style as the recent change in transpose-sexps, so I
>> hope it isn't too controversial.
>
> Thanks.
>
>>
>> What exact node types do you consider useful for sentence movement?
>>
>
> I haven't thought much about your proposed nodes, I initially thought
> that sentences in a programming language are just "statements".
They aren't really proper propsals. Mostly some example values to show
that the code works. The problem with just stating "statements" is that
the names are different across parsers. So in java one would call
```
void foo() {
var foo = 5; // <-- This thing
}
```
A "local_variable_declaration" or something like that. But it would
make sense for M-e to move across that whole line. So this is language
dependent, I believe.
>
> As a suggestion, treesit-forward-sentence could navigate by textual
> sentences when point is inside comments or strings.
>
Yeah, this is a good idea - added in following patch.
>> +** New defvar-local forward-sentence-function.
>> +The previous implementation of 'forward-sentence' is moved into this
>> +variable, which can be set to customize the sentece movement behavior.
> ^^^^^^^
> sentence
>
Thanks - fixed.
> Also, this feature probably needs an update to the Info documentation to
> mention that Tree-sitter can specialize sentence commands in programming
> modes.
Yes, likely. I will add this a bit later, when we agree on its behavior
fully :)
@Eli, what doc changes do you see as needed here?
@Juri: I added a change with how I understood what you meant. Is that
in your line of reasoning?
Theo
[0001-Add-forward-sentence-with-tree-sitter-support-bug-60.patch (text/x-patch, attachment)]
This bug report was last modified 2 years and 131 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.