aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2025-04-20 20:46:31 +0300
committerJuri Linkov2025-04-20 20:46:31 +0300
commitd7b56fc2ee9d32f6fd9f3b6e8d3772fb714f0f32 (patch)
treefd3ee1708c16a76a6d6dce5a4a0c67e6e9e93bf5
parent4151a44f605631d8d4028e1c2458a0a8c206a64d (diff)
downloademacs-d7b56fc2ee9d32f6fd9f3b6e8d3772fb714f0f32.tar.gz
emacs-d7b56fc2ee9d32f6fd9f3b6e8d3772fb714f0f32.zip
* lisp/treesit.el (treesit-cycle-sexp-type): Add optional arg 'interactive'.
Display the message only for interactive usage.
-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.