(point) (point))))))
(setq cnt (- cnt inc)))))
-(defun treesit-cycle-sexp-type ()
+(defun treesit-cycle-sexp-type (&optional interactive)
"Cycle the type of navigation for sexp and list commands.
This type affects navigation commands such as `treesit-forward-sexp',
`treesit-forward-list', `treesit-down-list', `treesit-up-list'.
The `sexp' type uses the `sexp' thing defined in `treesit-thing-settings'.
With this type commands use only the treesit definition of parser nodes,
without distinction between symbols and lists."
- (interactive)
+ (interactive "p")
(if (not (treesit-thing-defined-p 'list (treesit-language-at (point))))
- (message "No `list' thing is defined in `treesit-thing-settings'")
+ (user-error "No `list' thing is defined in `treesit-thing-settings'")
(setq-local treesit-sexp-type-regexp
(unless treesit-sexp-type-regexp
(if (treesit-thing-defined-p
(if treesit-sexp-type-regexp
#'treesit-forward-sexp
#'treesit-forward-sexp-list))
- (message "Cycle sexp type to navigate %s"
- (or (and treesit-sexp-type-regexp
- "treesit nodes")
- "syntax symbols and treesit lists"))))
+ (when interactive
+ (message "Cycle sexp type to navigate %s"
+ (or (and treesit-sexp-type-regexp
+ "treesit nodes")
+ "syntax symbols and treesit lists")))))
(defun treesit-transpose-sexps (&optional arg)
"Tree-sitter `transpose-sexps' function.