Fix down-list navigation in python-ts-mode

* lisp/progmodes/python.el (python-ts-mode):
Set 'treesit-sexp-thing-down-list' to 'list' to override
sexp navigation with list navigation (bug#72478).

* lisp/emacs-lisp/lisp.el (up-list): Mention 'up-list-function' in docstring.
This commit is contained in:
Juri Linkov 2026-01-21 20:02:56 +02:00
parent 15d3cc3f65
commit 8063921808
2 changed files with 4 additions and 1 deletions

View file

@ -250,6 +250,8 @@ defined by the current language mode. With ARG, do this that
many times. A negative argument means move backward but still to
a less deep spot.
Calls `up-list-function' to do the work, if that is non-nil.
If ESCAPE-STRINGS is non-nil (as it is interactively), move out
of enclosing strings as well.

View file

@ -7485,7 +7485,8 @@ implementations: `python-mode' and `python-ts-mode'."
(treesit-major-mode-setup)
;; Enable the `sexp' navigation by default
(setq-local forward-sexp-function #'treesit-forward-sexp
treesit-sexp-thing 'sexp)
treesit-sexp-thing 'sexp
treesit-sexp-thing-down-list 'list)
(when (>= emacs-major-version 31)
(setq-local hs-treesit-things '(or defun sexp))