aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/treesit.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/treesit.el')
-rw-r--r--lisp/treesit.el15
1 files changed, 8 insertions, 7 deletions
diff --git a/lisp/treesit.el b/lisp/treesit.el
index 72459a5a94f..69abef22e0e 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -3200,7 +3200,7 @@ ARG is described in the docstring of `up-list'."
3200 (point) (point)))))) 3200 (point) (point))))))
3201 (setq cnt (- cnt inc))))) 3201 (setq cnt (- cnt inc)))))
3202 3202
3203(defun treesit-cycle-sexp-type () 3203(defun treesit-cycle-sexp-type (&optional interactive)
3204 "Cycle the type of navigation for sexp and list commands. 3204 "Cycle the type of navigation for sexp and list commands.
3205This type affects navigation commands such as `treesit-forward-sexp', 3205This type affects navigation commands such as `treesit-forward-sexp',
3206`treesit-forward-list', `treesit-down-list', `treesit-up-list'. 3206`treesit-forward-list', `treesit-down-list', `treesit-up-list'.
@@ -3214,9 +3214,9 @@ navigate symbols and treesit definition to navigate lists.
3214The `sexp' type uses the `sexp' thing defined in `treesit-thing-settings'. 3214The `sexp' type uses the `sexp' thing defined in `treesit-thing-settings'.
3215With this type commands use only the treesit definition of parser nodes, 3215With this type commands use only the treesit definition of parser nodes,
3216without distinction between symbols and lists." 3216without distinction between symbols and lists."
3217 (interactive) 3217 (interactive "p")
3218 (if (not (treesit-thing-defined-p 'list (treesit-language-at (point)))) 3218 (if (not (treesit-thing-defined-p 'list (treesit-language-at (point))))
3219 (message "No `list' thing is defined in `treesit-thing-settings'") 3219 (user-error "No `list' thing is defined in `treesit-thing-settings'")
3220 (setq-local treesit-sexp-type-regexp 3220 (setq-local treesit-sexp-type-regexp
3221 (unless treesit-sexp-type-regexp 3221 (unless treesit-sexp-type-regexp
3222 (if (treesit-thing-defined-p 3222 (if (treesit-thing-defined-p
@@ -3227,10 +3227,11 @@ without distinction between symbols and lists."
3227 (if treesit-sexp-type-regexp 3227 (if treesit-sexp-type-regexp
3228 #'treesit-forward-sexp 3228 #'treesit-forward-sexp
3229 #'treesit-forward-sexp-list)) 3229 #'treesit-forward-sexp-list))
3230 (message "Cycle sexp type to navigate %s" 3230 (when interactive
3231 (or (and treesit-sexp-type-regexp 3231 (message "Cycle sexp type to navigate %s"
3232 "treesit nodes") 3232 (or (and treesit-sexp-type-regexp
3233 "syntax symbols and treesit lists")))) 3233 "treesit nodes")
3234 "syntax symbols and treesit lists")))))
3234 3235
3235(defun treesit-transpose-sexps (&optional arg) 3236(defun treesit-transpose-sexps (&optional arg)
3236 "Tree-sitter `transpose-sexps' function. 3237 "Tree-sitter `transpose-sexps' function.