[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#60894: 30.0.50; [PATCH] Add treesit-forward-sexp
From: |
Theodor Thornhill |
Subject: |
bug#60894: 30.0.50; [PATCH] Add treesit-forward-sexp |
Date: |
Tue, 17 Jan 2023 22:07:45 +0100 |
Dmitry Gutov <dgutov@yandex.ru> writes:
> On 17/01/2023 22:44, Theodor Thornhill via Bug reports for GNU Emacs,
> the Swiss army knife of text editors wrote:
>> 1. What should a sexp be?
>>
>> Is it basically "everything", or is there a distincition between
>> "word", "sexp" and "sentence"? For lisp forward-sexp looks like a
>> "jump over words, or a balanced pair of parens". In other languages
>> that can look a little weird - consider:
>>
>> ```
>> foo().|bar().baz(); -> foo().bar|().baz(); -> foo().bar()|.baz();
>> ```
>>
>> In a sense it could be considered "better", or at least distinct from
>> forward-word to:
>>
>> ```
>> foo().|bar().baz(); -> foo().bar()|.baz(); -> foo().bar().baz()|;
>
> One of the key things for Ruby, I think, is to jump over expressions.
>
> E.g. when the point is before 'def' in
>
> def foo
> ...
> end
>
> forward-sexp jumps to after 'end'. And backward-sexp jumps back.
>
> Same for
>
> if 2 == 3
> ...
> end
>
> , parenthesized expressions and (less important) method calls and
> statements as well.
Test this very untested addition to the patch (I know no ruby). It
seems to do what you want. I'd consider this sentence movement, though.
For M-e
Theo
0001-Add-treesit-forward-sexp.patch
Description: Text Data
- bug#60894: 30.0.50; [PATCH] Add treesit-forward-sexp, Theodor Thornhill, 2023/01/17
- bug#60894: 30.0.50; [PATCH] Add treesit-forward-sexp, Dmitry Gutov, 2023/01/17
- bug#60894: 30.0.50; [PATCH] Add treesit-forward-sexp,
Theodor Thornhill <=
- bug#60894: 30.0.50; [PATCH] Add treesit-forward-sexp, Dmitry Gutov, 2023/01/17
- bug#60894: 30.0.50; [PATCH] Add treesit-forward-sexp, Theodor Thornhill, 2023/01/18
- bug#60894: 30.0.50; [PATCH] Add treesit-forward-sexp, Eli Zaretskii, 2023/01/18
- bug#60894: 30.0.50; [PATCH] Add treesit-forward-sexp, Dmitry Gutov, 2023/01/18
- bug#60894: 30.0.50; [PATCH] Add treesit-forward-sexp, Theodor Thornhill, 2023/01/18
- bug#60894: 30.0.50; [PATCH] Add treesit-forward-sexp, Stefan Monnier, 2023/01/18
- bug#60894: 30.0.50; [PATCH] Add treesit-forward-sexp, Dmitry Gutov, 2023/01/18
- bug#60894: 30.0.50; [PATCH] Add treesit-forward-sexp, Stefan Monnier, 2023/01/18
- bug#60894: 30.0.50; [PATCH] Add treesit-forward-sexp, Dmitry Gutov, 2023/01/18
- bug#60894: 30.0.50; [PATCH] Add treesit-forward-sexp, Stefan Monnier, 2023/01/18