diff options
| author | Yuan Fu | 2022-12-15 17:25:06 -0800 |
|---|---|---|
| committer | Yuan Fu | 2022-12-15 17:29:44 -0800 |
| commit | 037407ad95a55df900bd508ca3c44499735d7c2a (patch) | |
| tree | 9359c3a229e5905a4e1e8512c54f5beae66d7f90 /lisp/progmodes/python.el | |
| parent | fee2efe1b035d601ac53a32801227402e9be8bca (diff) | |
| download | emacs-037407ad95a55df900bd508ca3c44499735d7c2a.tar.gz emacs-037407ad95a55df900bd508ca3c44499735d7c2a.zip | |
Add "function" feature to python-ts-mode (bug#59977)
* lisp/progmodes/python.el (python--treesit-settings): Add feature.
(python-ts-mode): Add feature. And fix indentation for the
python-indent-guess-indent-offset code.
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index a10359b384a..bdc9e6fa78c 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -1095,6 +1095,14 @@ fontified." | |||
| 1095 | (class_definition | 1095 | (class_definition |
| 1096 | name: (identifier) @font-lock-type-face)) | 1096 | name: (identifier) @font-lock-type-face)) |
| 1097 | 1097 | ||
| 1098 | :feature 'function | ||
| 1099 | :language 'python | ||
| 1100 | '((function_definition | ||
| 1101 | name: (identifier) @font-lock-function-name-face) | ||
| 1102 | (call function: (identifier) @font-lock-function-name-face) | ||
| 1103 | (call function: (attribute | ||
| 1104 | attribute: (identifier) @font-lock-function-name-face))) | ||
| 1105 | |||
| 1098 | :feature 'keyword | 1106 | :feature 'keyword |
| 1099 | :language 'python | 1107 | :language 'python |
| 1100 | `([,@python--treesit-keywords] @font-lock-keyword-face | 1108 | `([,@python--treesit-keywords] @font-lock-keyword-face |
| @@ -6629,7 +6637,7 @@ implementations: `python-mode' and `python-ts-mode'." | |||
| 6629 | ( keyword string type) | 6637 | ( keyword string type) |
| 6630 | ( assignment builtin constant decorator | 6638 | ( assignment builtin constant decorator |
| 6631 | escape-sequence number property string-interpolation ) | 6639 | escape-sequence number property string-interpolation ) |
| 6632 | ( bracket delimiter operator))) | 6640 | ( function bracket delimiter operator))) |
| 6633 | (setq-local treesit-font-lock-settings python--treesit-settings) | 6641 | (setq-local treesit-font-lock-settings python--treesit-settings) |
| 6634 | (setq-local imenu-create-index-function | 6642 | (setq-local imenu-create-index-function |
| 6635 | #'python-imenu-treesit-create-index) | 6643 | #'python-imenu-treesit-create-index) |
| @@ -6637,8 +6645,8 @@ implementations: `python-mode' and `python-ts-mode'." | |||
| 6637 | "_definition")) | 6645 | "_definition")) |
| 6638 | (treesit-major-mode-setup) | 6646 | (treesit-major-mode-setup) |
| 6639 | 6647 | ||
| 6640 | (when python-indent-guess-indent-offset | 6648 | (when python-indent-guess-indent-offset |
| 6641 | (python-indent-guess-indent-offset)))) | 6649 | (python-indent-guess-indent-offset)))) |
| 6642 | 6650 | ||
| 6643 | ;;; Completion predicates for M-x | 6651 | ;;; Completion predicates for M-x |
| 6644 | ;; Commands that only make sense when editing Python code | 6652 | ;; Commands that only make sense when editing Python code |