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: Yuan Fu
Subject: Re: Plug treesit.el into other emacs constructs
Date: Tue, 13 Dec 2022 11:53:18 -0800

> 
>> I mean, what construct is each one expected to jump over?
> 
> In my book "sexp" movement should jump over subtrees of the AST.

It’s pretty hard to judge which subtree to move over at a given point in an 
AST. For example, when point is at | in the following text:

(|X.y(z), alpha)

Should point move over X, or X.y, or X.y(z)? All three subtrees has their 
beg=(point). A human can tell (and might disagree on) which unit to move 
across, but a program couldn’t tell. Without language specific knowledge, it 
can’t really decide. 

Just a thought, but maybe we can let major modes define what’s an “abstract 
list”, and sexp-forward would move across the immediate children of abstract 
lists. Eg, abstract lists in C would contain block, argument list, statement, 
etc. And in the example above forward-sexp would move across X.y(z) because 
it’s an immediate children of the enclosing abstract list, the argument list.

Yuan


reply via email to

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