From: Theodor Thornhill Date: Sun, 22 Jan 2023 10:27:37 +0000 (+0100) Subject: Add sentence and sexp movement to python-ts-mode X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2afcab69899beaf5a2e911c8549d9b9c01a2fe5c;p=emacs.git Add sentence and sexp movement to python-ts-mode * lisp/progmodes/python.el (python-ts-mode): Add relevant node types. (Bug#60856) (cherry picked from commit c9e30e8c77d903a117e9319b264c7b66af499713) --- diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 3fbe2a47102..4e80b8ab5fe 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -7199,6 +7199,20 @@ implementations: `python-mode' and `python-ts-mode'." "_definition")) (setq-local treesit-defun-name-function #'python--treesit-defun-name) + + (setq-local treesit-sentence-type-regexp + (regexp-opt '("statement" + "clause"))) + + (setq-local treesit-sexp-type-regexp + (regexp-opt '("expression" + "string" + "call" + "operator" + "identifier" + "integer" + "float"))) + (treesit-major-mode-setup) (setq-local syntax-propertize-function #'python--treesit-syntax-propertize)