GNU bug report logs - #73404
30.0.50; [forward/kill/etc]-sexp commands do not behave as expected in tree-sitter modes

Previous Next

Package: emacs;

Reported by: Mickey Petersen <mickey <at> masteringemacs.org>

Date: Sat, 21 Sep 2024 05:13:01 UTC

Severity: normal

Merged with 74366

Found in version 30.0.50

Fixed in version 31.0.50

Done: Juri Linkov <juri <at> linkov.net>

Bug is archived. No further changes may be made.

Full log


Message #121 received at 73404 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Juri Linkov <juri <at> linkov.net>
Cc: Mickey Petersen <mickey <at> masteringemacs.org>, Eli Zaretskii <eliz <at> gnu.org>,
 Theodor Thornhill <theo <at> thornhill.no>, 73404 <at> debbugs.gnu.org,
 Stefan Monnier <monnier <at> iro.umontreal.ca>
Subject: Re: bug#73404: 30.0.50; [forward/kill/etc]-sexp commands do not
 behave as expected in tree-sitter modes
Date: Wed, 25 Dec 2024 00:34:45 -0800

> On Dec 24, 2024, at 11:44 PM, Juri Linkov <juri <at> linkov.net> wrote:
> 
>>> For html-ts-mode a list node is "element", and the node to skip
>>> is "tag".  So for example:
>>> 
>>> -!-text <html></html>
>>> 
>>> 'C-M-f' will use node "element" to move to the beginning of "element":
>>> 
>>> text -!-<html></html>
>>> 
>>> then to get inside also need to skip the <html> tag:
>>> 
>>> text <html>-!-</html>
>> 
>> Right, the thing navigation only supports going up/outside, but not going
>> down/inside. We can add a new thing for beginning and end of balanced
>> pairs. Then down-list will be going from the start of a balanced-pair-open
>> to the end of it. Up-list will be going from the start of
>> a balanced-pair-close to the end of it.
> 
> Probably we could use just such heuristics that 'down-list' should skip
> the first node of the balanced pair.  This should work for most ts-modes.
> 
> For example, for 'jsx_element' the first child to skip is 'jsx_opening_element'.
> For 'argument_list' the first child to skip is an anonymous node "(".
> For 'statement_block' the first child to skip is an anonymous node "{“.

Yes, that should work for the vast majority of grammars. I can’t think of an counter example other than for_statment in tree-sitter-c.

Yuan






This bug report was last modified 131 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.