Function: treesit-down-list
treesit-down-list is an interactive and byte-compiled function defined
in treesit.el.gz.
Signature
(treesit-down-list &optional ARG)
Documentation
Move forward down one level of parentheses.
What constitutes a level of parentheses is determined by
list in treesit-thing-settings that usually defines
parentheses-like expressions.
This command is the tree-sitter variant of down-list
redefined by the variable down-list-function.
ARG is described in the docstring of down-list.
Probably introduced at or before Emacs version 31.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/treesit.el.gz
(defun treesit-down-list (&optional arg)
"Move forward down one level of parentheses.
What constitutes a level of parentheses is determined by
`list' in `treesit-thing-settings' that usually defines
parentheses-like expressions.
This command is the tree-sitter variant of `down-list'
redefined by the variable `down-list-function'.
ARG is described in the docstring of `down-list'."
(interactive "^p")
(let* ((pred (or treesit-sexp-thing-down-list
treesit-sexp-thing
'list))
(arg (or arg 1))
(cnt arg)
(inc (if (> arg 0) 1 -1)))
(while (/= cnt 0)
(let* ((default-pos
(condition-case _
(save-excursion
(down-list-default-function inc)
(point))
(scan-error nil)))
(sibling (if (> arg 0)
(treesit-thing-next (point) pred)
(treesit-thing-prev (point) pred)))
(child (when sibling
(treesit-node-child sibling (if (> arg 0) 0 -1)))))
(or (when (and (null (or treesit-sexp-thing-down-list
treesit-sexp-thing))
default-pos
(or (null child)
(if (> arg 0)
(<= default-pos (treesit-node-start child))
(>= default-pos (treesit-node-end child)))))
(goto-char default-pos))
(when child
(goto-char (if (> arg 0)
(treesit-node-end child)
(treesit-node-start child))))
(treesit--scan-error pred arg)))
(setq cnt (- cnt inc)))))