mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-06 06:20:55 -08:00
* lisp/treesit.el (treesit-cycle-sexp-type): Add optional arg 'interactive'.
Display the message only for interactive usage.
This commit is contained in:
parent
4151a44f60
commit
d7b56fc2ee
1 changed files with 8 additions and 7 deletions
|
|
@ -3200,7 +3200,7 @@ ARG is described in the docstring of `up-list'."
|
||||||
(point) (point))))))
|
(point) (point))))))
|
||||||
(setq cnt (- cnt inc)))))
|
(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.
|
"Cycle the type of navigation for sexp and list commands.
|
||||||
This type affects navigation commands such as `treesit-forward-sexp',
|
This type affects navigation commands such as `treesit-forward-sexp',
|
||||||
`treesit-forward-list', `treesit-down-list', `treesit-up-list'.
|
`treesit-forward-list', `treesit-down-list', `treesit-up-list'.
|
||||||
|
|
@ -3214,9 +3214,9 @@ navigate symbols and treesit definition to navigate lists.
|
||||||
The `sexp' type uses the `sexp' thing defined in `treesit-thing-settings'.
|
The `sexp' type uses the `sexp' thing defined in `treesit-thing-settings'.
|
||||||
With this type commands use only the treesit definition of parser nodes,
|
With this type commands use only the treesit definition of parser nodes,
|
||||||
without distinction between symbols and lists."
|
without distinction between symbols and lists."
|
||||||
(interactive)
|
(interactive "p")
|
||||||
(if (not (treesit-thing-defined-p 'list (treesit-language-at (point))))
|
(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
|
(setq-local treesit-sexp-type-regexp
|
||||||
(unless treesit-sexp-type-regexp
|
(unless treesit-sexp-type-regexp
|
||||||
(if (treesit-thing-defined-p
|
(if (treesit-thing-defined-p
|
||||||
|
|
@ -3227,10 +3227,11 @@ without distinction between symbols and lists."
|
||||||
(if treesit-sexp-type-regexp
|
(if treesit-sexp-type-regexp
|
||||||
#'treesit-forward-sexp
|
#'treesit-forward-sexp
|
||||||
#'treesit-forward-sexp-list))
|
#'treesit-forward-sexp-list))
|
||||||
(message "Cycle sexp type to navigate %s"
|
(when interactive
|
||||||
(or (and treesit-sexp-type-regexp
|
(message "Cycle sexp type to navigate %s"
|
||||||
"treesit nodes")
|
(or (and treesit-sexp-type-regexp
|
||||||
"syntax symbols and treesit lists"))))
|
"treesit nodes")
|
||||||
|
"syntax symbols and treesit lists")))))
|
||||||
|
|
||||||
(defun treesit-transpose-sexps (&optional arg)
|
(defun treesit-transpose-sexps (&optional arg)
|
||||||
"Tree-sitter `transpose-sexps' function.
|
"Tree-sitter `transpose-sexps' function.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue