aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorJuri Linkov2025-04-30 20:28:05 +0300
committerJuri Linkov2025-04-30 20:28:05 +0300
commitdbd168823794ef2173bb6eb894174bc0c1685cd9 (patch)
tree85fb656eadfd9e6f6301c2bca95636c235131c03 /lisp/progmodes/python.el
parentab9580920278e69ecf1ccbd8dbf3cc1a0f8b019f (diff)
downloademacs-dbd168823794ef2173bb6eb894174bc0c1685cd9.tar.gz
emacs-dbd168823794ef2173bb6eb894174bc0c1685cd9.zip
Add python tree-sitter grammar data to 'treesit-language-source-alist'.
* lisp/progmodes/python.el (python-ts-mode): Use 'treesit-ensure-installed' when it's fboundp.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el9
1 files changed, 8 insertions, 1 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 8848a98fe5f..32df5846b67 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -269,6 +269,11 @@
269(declare-function treesit-node-parent "treesit.c") 269(declare-function treesit-node-parent "treesit.c")
270(declare-function treesit-node-prev-sibling "treesit.c") 270(declare-function treesit-node-prev-sibling "treesit.c")
271 271
272(add-to-list
273 'treesit-language-source-alist
274 '(python "https://github.com/tree-sitter/tree-sitter-python" "v0.23.6")
275 t)
276
272;; Avoid compiler warnings 277;; Avoid compiler warnings
273(defvar compilation-error-regexp-alist) 278(defvar compilation-error-regexp-alist)
274(defvar outline-heading-end-regexp) 279(defvar outline-heading-end-regexp)
@@ -7294,7 +7299,9 @@ implementations: `python-mode' and `python-ts-mode'."
7294 7299
7295\\{python-ts-mode-map}" 7300\\{python-ts-mode-map}"
7296 :syntax-table python-mode-syntax-table 7301 :syntax-table python-mode-syntax-table
7297 (when (treesit-ready-p 'python) 7302 (when (if (fboundp 'treesit-ensure-installed) ; Emacs 31
7303 (treesit-ensure-installed 'python)
7304 (treesit-ready-p 'python))
7298 (setq treesit-primary-parser (treesit-parser-create 'python)) 7305 (setq treesit-primary-parser (treesit-parser-create 'python))
7299 (setq-local treesit-font-lock-feature-list 7306 (setq-local treesit-font-lock-feature-list
7300 '(( comment definition) 7307 '(( comment definition)