summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2023-04-27 21:39:33 +0300
committerEli Zaretskii <eliz@gnu.org>2023-04-27 21:39:33 +0300
commit0cf6e0998badfa3d2d9e93791cd581f2e00fff0b (patch)
tree551d4dc292c55f8afe352d5f5fa3ec0aadc6946d
parent933705d61e58465a8a0b89a8f747c8265a9e2a81 (diff)
downloademacs-0cf6e0998badfa3d2d9e93791cd581f2e00fff0b.tar.gz
* Makefile.in (distclean): Remove the 'native-lisp' directory.
-rw-r--r--Makefile.in3
-rw-r--r--lisp/treesit.el17
2 files changed, 16 insertions, 4 deletions
diff --git a/Makefile.in b/Makefile.in
index 8b77aac38cd..f5fda0eb61a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1030,6 +1030,9 @@ $(foreach dir,$(distclean_dirs),$(eval $(call submake_template,$(dir),distclean)
distclean: $(distclean_dirs:=_distclean) clean-gsettings-schemas
${top_distclean}
+ifeq ($(HAVE_NATIVE_COMP),yes)
+ rm -rf native-lisp
+endif
### 'bootstrap-clean'
### Delete everything that can be reconstructed by 'make' and that
diff --git a/lisp/treesit.el b/lisp/treesit.el
index e718ea1a23a..1d4749c8cd2 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -378,13 +378,16 @@ See `treesit-query-capture' for QUERY."
(defun treesit-query-range (node query &optional beg end)
"Query the current buffer and return ranges of captured nodes.
-QUERY, NODE, BEG, END are the same as in
-`treesit-query-capture'. This function returns a list
-of (START . END), where START and END specifics the range of each
-captured node. Capture names don't matter."
+QUERY, NODE, BEG, END are the same as in `treesit-query-capture'.
+This function returns a list of (START . END), where START and
+END specifics the range of each captured node. Capture names
+generally don't matter, but names that starts with an underscore
+are ignored."
(cl-loop for capture
in (treesit-query-capture node query beg end)
+ for name = (car capture)
for node = (cdr capture)
+ if (not (string-prefix-p "_" (symbol-name name)))
collect (cons (treesit-node-start node)
(treesit-node-end node))))
@@ -399,6 +402,9 @@ When updating the range of each parser in the buffer,
range to the range spanned by captured nodes. QUERY must be a
compiled query.
+Capture names generally don't matter, but names that starts with
+an underscore are ignored.
+
QUERY can also be a function, in which case it is called with 2
arguments, START and END. It should ensure parsers' ranges are
correct in the region between START and END.
@@ -418,6 +424,9 @@ like this:
Each QUERY is a tree-sitter query in either the string,
s-expression or compiled form.
+Capture names generally don't matter, but names that starts with
+an underscore are ignored.
+
For each QUERY, :KEYWORD and VALUE pairs add meta information to
it. For example,