diff --git a/etc/NEWS b/etc/NEWS index e38bba79535..28ee6301829 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -538,13 +538,14 @@ This variable has no effect when Transient Mark mode is off. ** Tree-sitter *** New command 'treesit-toggle-sexp-mode'. -It toggles the mode of navigation for such sexp and list commands as -'treesit-forward-sexp', 'treesit-forward-list', 'treesit-down-list', -'treesit-up-list'. -In sexp mode these commands navigate purely by treesit nodes -defined by the thing ‘sexp’. -In list mode they navigate using syntax tables for symbols -and using the treesit thing ‘list’ for lists. +It toggles the mode of navigation for commands that move across sexp's +and lists, such as 'treesit-forward-sexp', 'treesit-forward-list', +'treesit-down-list', and 'treesit-up-list'. This mode can be either +'list', the default, or 'sexp'. +In the default 'list' mode these commands move using syntax tables for +symbols and using the thing 'list' for lists. +In 'sexp' mode these commands move by treesit-defined parser nodes +defined by the treesit thing 'sexp' as determined by 'treesit-thing-at'. --- ** Text mode diff --git a/lisp/treesit.el b/lisp/treesit.el index 54270bf9e58..9d9863e5575 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -3190,16 +3190,18 @@ ARG is described in the docstring of `up-list'." (defun treesit-toggle-sexp-mode () "Toggle the mode of navigation for sexp and list commands. -This mode toggle affects such navigation commands as +This mode toggle affects navigation commands such as `treesit-forward-sexp', `treesit-forward-list', `treesit-down-list', `treesit-up-list'. -The list mode uses the `list' thing defined in `treesit-thing-settings'. -In this mode commands use syntax definition to navigate symbols and -treesit definition to navigate lists. +The mode can be `list' (the default) or `sexp'. -The sexp mode uses the `sexp' thing defined in `treesit-thing-settings'. -In this mode commands use the treesit definition only +The `list' mode uses the `list' thing defined in `treesit-thing-settings'. +See `treesit-thing-at-point'. In this mode commands use syntax tables to +navigate symbols and treesit definition to navigate lists. + +The `sexp' mode uses the `sexp' thing defined in `treesit-thing-settings'. +In this mode commands use only the treesit definition of parser nodes, without distinction between symbols and lists." (interactive) (if (not (treesit-thing-defined-p 'list (treesit-language-at (point))))