emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Plug treesit.el into other emacs constructs


From: Theodor Thornhill
Subject: Re: Plug treesit.el into other emacs constructs
Date: Wed, 14 Dec 2022 19:07:23 +0100


On 14 December 2022 18:46:36 CET, Stefan Monnier <monnier@iro.umontreal.ca> 
wrote:
>>>and when moving backward it moves from
>>>
>>>    int a = 0;
>>>    int b = 1;|
>>>
>>>to
>>>
>>>    int a = 0;|
>>>    int b = 1;
>>>
>>>> But if we move over the smallest
>>>> subtree, I’d imagine it only move across the semicolon after [1].
>>>
>>
>> Doesn't this look like forward-sentence?
>
>In this case, yes.  But in other cases it will move at different levels
>of the tree.  E.g.:
>
>   int x = f (b + 4, c * 7 - z * 2, d, e);
>
>It will sometimes move over the whole instruction, and other times over
>just a single variable or over a whole argument or over just a "factor".
>This depends on where point is when `forward/backward-sexp` is called.

Yeah. I think this example shows what I find unintuitive. If point is right 
before the first comma, and we transpose-sexps, it could end up swapping 4 for 
c * 7 - z * 2, which would rarely make sense in this context. Swapping b + 4 
with c * 7 - z * 2 would make sense here, imo. I believe this is not how you 
see it? 

Theo



reply via email to

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