1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

; Another fix for doc strings of 2 treesit.el functions

* lisp/treesit.el (treesit-parent-while): Clarify "closest" and
"furthest" in the doc string.  (Bug#60531)
This commit is contained in:
Eli Zaretskii 2023-01-05 09:34:02 +02:00
parent 3fc6883351
commit 8a18369afd

View file

@ -302,9 +302,15 @@ properties."
(defun treesit-parent-until (node pred &optional include-node) (defun treesit-parent-until (node pred &optional include-node)
"Return the closest parent of NODE that satisfies PRED. "Return the closest parent of NODE that satisfies PRED.
Return nil if none was found. PRED should be a function that This function successively examines the parent of NODE, then
takes one argument, the node to examine, and returns a boolean the parent of the parent, etc., until it finds the first
value indicating whether that node is a match. ancestor node which satisfies the predicate PRED; then it
returns that ancestor node. It returns nil if no ancestor
node was found that satisfies PRED.
PRED should be a function that takes one argument, the node to
examine, and returns a boolean value indicating whether that
node is a match.
If INCLUDE-NODE is non-nil, return NODE if it satisfies PRED." If INCLUDE-NODE is non-nil, return NODE if it satisfies PRED."
(let ((node (if include-node node (let ((node (if include-node node
@ -315,9 +321,16 @@ If INCLUDE-NODE is non-nil, return NODE if it satisfies PRED."
(defun treesit-parent-while (node pred) (defun treesit-parent-while (node pred)
"Return the furthest parent of NODE that satisfies PRED. "Return the furthest parent of NODE that satisfies PRED.
Return nil if none was found. PRED should be a function that
takes one argument, the node to examine, and returns a boolean This function successively examines the parent of NODE, then
value indicating whether that node is a match." the parent of the parent, etc., until it finds an ancestor node
which no longer satisfies the predicate PRED; it returns the last
examined ancestor that satisfies PRED. It returns nil if no
ancestor node was found that satisfies PRED.
PRED should be a function that takes one argument, the node to
examine, and returns a boolean value indicating whether that
node is a match."
(let ((last nil)) (let ((last nil))
(while (and node (funcall pred node)) (while (and node (funcall pred node))
(setq last node (setq last node