From c352392420236d4fa7a8ac7f324f1a0358ad3584 Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Wed, 26 Oct 2022 15:38:40 -0700 Subject: [PATCH] Add tree-sitter navigation support to python-mode * lisp/progmodes/python.el (python-mode): Set treesit-defun-type-regexp. --- lisp/progmodes/python.el | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 2c0c35174c2..97839366350 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -6473,6 +6473,10 @@ Add import for undefined name `%s' (empty to skip): " (setq-local treesit-font-lock-settings python--treesit-settings) (setq-local imenu-create-index-function #'python-imenu-treesit-create-index) + (setq-local treesit-defun-type-regexp (rx bol + (or "function" "class") + "_definition" + eol)) (treesit-major-mode-setup)) ;; Elisp. (t -- 2.39.2