From 34414b06f2c6b7f7daed26a546c23d69c4dcfe84 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 2 Sep 2023 10:08:21 +0300 Subject: [PATCH] ; Minor fixes of treesit docs * src/treesit.c (treesit_traverse_validate_predicate) (Ftreesit_search_subtree, Ftreesit_search_forward) (Ftreesit_induce_sparse_tree, Ftreesit_node_match_p): * lisp/treesit.el (treesit-beginning-of-thing) (treesit-end-of-thing, treesit--things-around): Fix commentary and doc strings. --- lisp/treesit.el | 12 ++++++------ src/treesit.c | 22 +++++++++++----------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/lisp/treesit.el b/lisp/treesit.el index 7fda533861a..1c96edbdbc7 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -1952,8 +1952,8 @@ If LANGUAGE is nil, return the first definition for THING in (defun treesit-beginning-of-thing (thing &optional arg tactic) "Like `beginning-of-defun', but generalized into things. -THING can be a thing defined in `treesit-thing-settings', or a -predicate, which see. ARG is the same as in `beginning-of-defun'. +THING can be a thing defined in `treesit-thing-settings', which see, +or a predicate. ARG is the same as in `beginning-of-defun'. TACTIC determines how does this function move between things. It can be `nested', `top-level', `restricted', or nil. `nested' @@ -1975,8 +1975,8 @@ Return non-nil if successfully moved, nil otherwise." (defun treesit-end-of-thing (thing &optional arg tactic) "Like `end-of-defun', but generalized into things. -THING can be a thing defined in `treesit-thing-settings', or a -predicate, which see. ARG is the same as in `end-of-defun'. +THING can be a thing defined in `treesit-thing-settings', which +see, or a predicate. ARG is the same as in `end-of-defun'. TACTIC determines how does this function move between things. It can be `nested', `top-level', `restricted', or nil. `nested' @@ -2140,8 +2140,8 @@ previous and next sibling things around POS, and PARENT is the parent thing surrounding POS. All of three could be nil if no sound things exists. -THING should be a thing defined in `treesit-thing-settings', it -can also be a predicate, which see." +THING should be a thing defined in `treesit-thing-settings', +which see; it can also be a predicate." (let* ((node (treesit-node-at pos)) (result (list nil nil nil))) ;; 1. Find previous and next sibling defuns. diff --git a/src/treesit.c b/src/treesit.c index 0158d769b99..5e00da83548 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -3247,8 +3247,8 @@ treesit_traverse_get_predicate (Lisp_Object thing, Lisp_Object language) recusion levels: we place a arbitrary 100 level limit on recursive predicates. RECURSION_LEVEL is the current recursion level (that starts at 0), if it goes over 99, return false and set SIGNAL_DATA. - LANGUAGE is a LANGUAGE symbol. See `Ftreesit_node_match_p' for - ignore_missing. */ + LANGUAGE is a LANGUAGE symbol. IGNORE_MISSING is as in + `treesit-node-match-p' below. */ static bool treesit_traverse_validate_predicate (Lisp_Object pred, Lisp_Object language, @@ -3521,7 +3521,7 @@ DEFUN ("treesit-search-subtree", Traverse the subtree of NODE, and match PREDICATE with each node along the way. PREDICATE can be a regexp string that matches against each node's type, a predicate function, and more. See -`treesit-thing-settings' for all possible predicates. PREDICATE can +`treesit-thing-settings' for the possible predicates. PREDICATE can also be a thing defined in `treesit-thing-settings'. By default, only traverse named nodes, but if ALL is non-nil, traverse @@ -3582,7 +3582,7 @@ DEFUN ("treesit-search-forward", Start traversing the tree from node START, and match PREDICATE with each node (except START itself) along the way. PREDICATE can be a regexp string that matches against each node's type, a predicate -function, and more. See `treesit-thing-settings' for all possible +function, and more. See `treesit-thing-settings' for the possible predicates. PREDICATE can also be a thing defined in `treesit-thing-settings'. @@ -3698,7 +3698,7 @@ This takes the subtree under ROOT, and combs it so only the nodes that match PREDICATE are left, like picking out grapes on the vine. PREDICATE can be a regexp string that matches against each node's type, a predicate function, and more. See `treesit-thing-settings' -for all possible predicates. PREDICATE can also be a thing defined in +for the possible predicates. PREDICATE can also be a thing defined in `treesit-thing-settings'. For a subtree on the left that consist of both numbers and letters, if @@ -3785,15 +3785,15 @@ DEFUN ("treesit-node-match-p", doc: /* Check whether NODE matches PREDICATE. PREDICATE can be a symbol representing a thing in -`treesit-thing-settings', or an predicate, like regexp matching node -type, etc. See `treesit-thing-settings' for detail. +`treesit-thing-settings', or a predicate, like regexp matching node +type, etc. See `treesit-thing-settings' for more details. -Return non-nil if NODE matches PRED, nil otherwise. +Return non-nil if NODE matches PREDICATE, nil otherwise. Signals `treesit-invalid-predicate' if there's no definition of THING -in `treesit-thing-settings', or the predicate is malformed. If -IGNORE-MISSING is non-nil, don't signal for missing THING definition, -but still signal for malformed predicate. */) +in `treesit-thing-settings', or if PREDICATE is malformed. If +IGNORE-MISSING is non-nil, don't signal an error for missing THING +definition, but still signal for malformed PREDICATE. */) (Lisp_Object node, Lisp_Object predicate, Lisp_Object ignore_missing) { CHECK_TS_NODE (node); -- 2.39.2