emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master c9e30e8c77d: Add sentence and sexp movement to python-ts-mode


From: Stefan Kangas
Subject: master c9e30e8c77d: Add sentence and sexp movement to python-ts-mode
Date: Thu, 3 Oct 2024 19:53:29 -0400 (EDT)

branch: master
commit c9e30e8c77d903a117e9319b264c7b66af499713
Author: Theodor Thornhill <theo@thornhill.no>
Commit: Stefan Kangas <stefankangas@gmail.com>

    Add sentence and sexp movement to python-ts-mode
    
    * lisp/progmodes/python.el (python-ts-mode): Add relevant node
    types.  (Bug#60856)
---
 lisp/progmodes/python.el | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index a9fb3e3de6a..56c80c8264b 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -7208,6 +7208,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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]