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 #166 received at 73404 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Yuan Fu <casouri <at> gmail.com>
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: Sat, 04 Jan 2025 19:46:12 +0200
>> BTW, my initial intention was to add the thing 'list'.
>> But then I discovered that (treesit-thing-next (point) 'list)
>> uses the function 'list' instead of the thing 'list'.
>> 
>> However, the current 'sexp-list' as a two-word composite is too ugly.
>> Now I found a better replacement: 'group'.  This word is already used
>> in lisp.el such as in the docstring of 'forward-list':
>
> I don’t have an opinion on this.  Groups sounds a bit abstract, but so
> does sexp-list.

Indeed, the right name is 'list'.  So let's use it.

The minimal change that doesn't require updating
all existing definitions of treesit-thing-settings,
is just to add an exception for 'list':

diff --git a/src/treesit.c b/src/treesit.c
index b3214dad836..2d15e64180d 100644
--- a/src/treesit.c
+++ b/src/treesit.c
@@ -3618,7 +3618,7 @@ treesit_traverse_validate_predicate (Lisp_Object pred,
     }
   if (STRINGP (pred))
     return true;
-  else if (FUNCTIONP (pred))
+  else if (FUNCTIONP (pred) && !BASE_EQ (pred, Qlist))
     return true;
   else if (SYMBOLP (pred))
     {
@@ -3722,7 +3722,7 @@ treesit_traverse_match_predicate (TSTreeCursor *cursor, Lisp_Object pred,
       const char *type = ts_node_type (node);
       return fast_c_string_match (pred, type, strlen (type)) >= 0;
     }
-  else if (FUNCTIONP (pred))
+  else if (FUNCTIONP (pred) && !BASE_EQ (pred, Qlist))
     {
       Lisp_Object lisp_node = make_treesit_node (parser, node);
       return !NILP (CALLN (Ffuncall, pred, lisp_node));




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.