bug-gnu-emacs
[Top][All Lists]
Advanced

[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

Attachment: 0001-Add-treesit-forward-sexp.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]