From 2afcab69899beaf5a2e911c8549d9b9c01a2fe5c Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Sun, 22 Jan 2023 11:27:37 +0100 Subject: [PATCH] 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) --- lisp/progmodes/python.el | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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) -- 2.39.2