]> git.eshelyaron.com Git - emacs.git/commitdiff
Add sentence and sexp movement to python-ts-mode
authorTheodor Thornhill <theo@thornhill.no>
Sun, 22 Jan 2023 10:27:37 +0000 (11:27 +0100)
committerEshel Yaron <me@eshelyaron.com>
Fri, 4 Oct 2024 10:12:22 +0000 (12:12 +0200)
* lisp/progmodes/python.el (python-ts-mode): Add relevant node
types.  (Bug#60856)

(cherry picked from commit c9e30e8c77d903a117e9319b264c7b66af499713)

lisp/progmodes/python.el

index 3fbe2a47102e9d9fe85ca9928d8b3417ce69858e..4e80b8ab5fe31904ef0ce88e536e936f9f242ce6 100644 (file)
@@ -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)