diff options
| author | Juri Linkov | 2025-04-30 20:28:05 +0300 |
|---|---|---|
| committer | Juri Linkov | 2025-04-30 20:28:05 +0300 |
| commit | dbd168823794ef2173bb6eb894174bc0c1685cd9 (patch) | |
| tree | 85fb656eadfd9e6f6301c2bca95636c235131c03 /lisp/progmodes/python.el | |
| parent | ab9580920278e69ecf1ccbd8dbf3cc1a0f8b019f (diff) | |
| download | emacs-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.el | 9 |
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) |