diff options
| author | Juri Linkov | 2025-04-20 20:46:31 +0300 |
|---|---|---|
| committer | Juri Linkov | 2025-04-20 20:46:31 +0300 |
| commit | d7b56fc2ee9d32f6fd9f3b6e8d3772fb714f0f32 (patch) | |
| tree | fd3ee1708c16a76a6d6dce5a4a0c67e6e9e93bf5 | |
| parent | 4151a44f605631d8d4028e1c2458a0a8c206a64d (diff) | |
| download | emacs-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.el | 15 |
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. |
| 3205 | This type affects navigation commands such as `treesit-forward-sexp', | 3205 | This 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. | |||
| 3214 | The `sexp' type uses the `sexp' thing defined in `treesit-thing-settings'. | 3214 | The `sexp' type uses the `sexp' thing defined in `treesit-thing-settings'. |
| 3215 | With this type commands use only the treesit definition of parser nodes, | 3215 | With this type commands use only the treesit definition of parser nodes, |
| 3216 | without distinction between symbols and lists." | 3216 | without 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. |