[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 7fc416d90b9 4/6: Don't signal error when calling treesit-node-mat
From: |
Yuan Fu |
Subject: |
master 7fc416d90b9 4/6: Don't signal error when calling treesit-node-match-p in treesit.el |
Date: |
Sat, 2 Sep 2023 00:04:33 -0400 (EDT) |
branch: master
commit 7fc416d90b95c6014c5745a84069844eab1e6e33
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>
Don't signal error when calling treesit-node-match-p in treesit.el
Specifically, don't signal error when the thing isn't defined.
* lisp/treesit.el (treesit-node-top-level)
(treesit-forward-sentence)
(treesit--things-around): Add IGNORE-MISSING argument.
---
lisp/treesit.el | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lisp/treesit.el b/lisp/treesit.el
index d77d9519eb6..a1272b97a3a 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -257,7 +257,7 @@ If INCLUDE-NODE is non-nil, return NODE if it satisfies
PRED."
(treesit-node-parent node))
then (treesit-node-parent cursor)
while cursor
- if (treesit-node-match-p cursor pred)
+ if (treesit-node-match-p cursor pred t)
do (setq result cursor))
result))
@@ -2090,7 +2090,7 @@ inside code, go forward a source code sentence.
What constitutes as text and source code sentence is determined
by `text' and `sentence' in `treesit-thing-settings'."
- (if (treesit-node-match-p (treesit-node-at (point)) 'text)
+ (if (treesit-node-match-p (treesit-node-at (point)) 'text t)
(funcall #'forward-sentence-default-function arg)
(funcall
(if (> arg 0) #'treesit-end-of-thing #'treesit-beginning-of-thing)
@@ -2156,7 +2156,7 @@ can also be a predicate, which see."
when node
do (let ((cursor node)
(iter-pred (lambda (node)
- (and (treesit-node-match-p node thing)
+ (and (treesit-node-match-p node thing t)
(funcall pos-pred node)))))
;; Find the node just before/after POS to start searching.
(save-excursion
@@ -2174,7 +2174,7 @@ can also be a predicate, which see."
;; 2. Find the parent defun.
(let ((cursor (or (nth 0 result) (nth 1 result) node))
(iter-pred (lambda (node)
- (and (treesit-node-match-p node thing)
+ (and (treesit-node-match-p node thing t)
(not (treesit-node-eq node (nth 0 result)))
(not (treesit-node-eq node (nth 1 result)))
(< (treesit-node-start node)
- master updated (d286f6889cf -> e6340934d62), Yuan Fu, 2023/09/02
- master ed152ccd1d6 3/6: Rename PRED to THING in tree-sitter navigation functions, Yuan Fu, 2023/09/02
- master 1e91183c399 5/6: ; * src/treesit.c (Vtreesit_thing_settings): Update docstring., Yuan Fu, 2023/09/02
- master 452697a81ab 2/6: Add an optional arg to Ftreesit_node_match_p, Yuan Fu, 2023/09/02
- master e6340934d62 6/6: ; * lisp/treesit.el (treesit-thing-settings): Declare in treesit.el., Yuan Fu, 2023/09/02
- master 7fc416d90b9 4/6: Don't signal error when calling treesit-node-match-p in treesit.el,
Yuan Fu <=
- master 2547fbe9c44 1/6: Obsolete treesit-block/sexp/sentence/text-type-regexp, Yuan Fu, 2023/09/02