diff options
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 4ac5f2e3b0a..2c0c35174c2 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -6391,15 +6391,6 @@ Add import for undefined name `%s' (empty to skip): " | |||
| 6391 | 6391 | ||
| 6392 | (setq-local forward-sexp-function python-forward-sexp-function) | 6392 | (setq-local forward-sexp-function python-forward-sexp-function) |
| 6393 | 6393 | ||
| 6394 | (setq-local font-lock-defaults | ||
| 6395 | `(,python-font-lock-keywords | ||
| 6396 | nil nil nil nil | ||
| 6397 | (font-lock-syntactic-face-function | ||
| 6398 | . python-font-lock-syntactic-face-function))) | ||
| 6399 | |||
| 6400 | (setq-local syntax-propertize-function | ||
| 6401 | python-syntax-propertize-function) | ||
| 6402 | |||
| 6403 | (setq-local indent-line-function #'python-indent-line-function) | 6394 | (setq-local indent-line-function #'python-indent-line-function) |
| 6404 | (setq-local indent-region-function #'python-indent-region) | 6395 | (setq-local indent-region-function #'python-indent-region) |
| 6405 | ;; Because indentation is not redundant, we cannot safely reindent code. | 6396 | ;; Because indentation is not redundant, we cannot safely reindent code. |
| @@ -6424,14 +6415,9 @@ Add import for undefined name `%s' (empty to skip): " | |||
| 6424 | (add-hook 'post-self-insert-hook | 6415 | (add-hook 'post-self-insert-hook |
| 6425 | #'python-indent-post-self-insert-function 'append 'local) | 6416 | #'python-indent-post-self-insert-function 'append 'local) |
| 6426 | 6417 | ||
| 6427 | (setq-local imenu-create-index-function | ||
| 6428 | #'python-imenu-create-index) | ||
| 6429 | |||
| 6430 | (setq-local add-log-current-defun-function | 6418 | (setq-local add-log-current-defun-function |
| 6431 | #'python-info-current-defun) | 6419 | #'python-info-current-defun) |
| 6432 | 6420 | ||
| 6433 | (add-hook 'which-func-functions #'python-info-current-defun nil t) | ||
| 6434 | |||
| 6435 | (setq-local skeleton-further-elements | 6421 | (setq-local skeleton-further-elements |
| 6436 | '((abbrev-mode nil) | 6422 | '((abbrev-mode nil) |
| 6437 | (< '(backward-delete-char-untabify (min python-indent-offset | 6423 | (< '(backward-delete-char-untabify (min python-indent-offset |
| @@ -6479,13 +6465,27 @@ Add import for undefined name `%s' (empty to skip): " | |||
| 6479 | 6465 | ||
| 6480 | (add-hook 'flymake-diagnostic-functions #'python-flymake nil t) | 6466 | (add-hook 'flymake-diagnostic-functions #'python-flymake nil t) |
| 6481 | 6467 | ||
| 6482 | (setq-local treesit-mode-supported t) | 6468 | (cond |
| 6483 | (setq-local treesit-required-languages '(python)) | 6469 | ;; Tree-sitter. |
| 6484 | (setq-local treesit-font-lock-feature-list | 6470 | ((treesit-ready-p 'python-mode 'python) |
| 6485 | '((basic) (moderate) (elaborate))) | 6471 | (setq-local treesit-font-lock-feature-list |
| 6486 | (setq-local treesit-font-lock-settings python--treesit-settings) | 6472 | '((basic) (moderate) (elaborate))) |
| 6487 | (setq-local treesit-imenu-function | 6473 | (setq-local treesit-font-lock-settings python--treesit-settings) |
| 6488 | #'python-imenu-treesit-create-index)) | 6474 | (setq-local imenu-create-index-function |
| 6475 | #'python-imenu-treesit-create-index) | ||
| 6476 | (treesit-major-mode-setup)) | ||
| 6477 | ;; Elisp. | ||
| 6478 | (t | ||
| 6479 | (setq-local font-lock-defaults | ||
| 6480 | `(,python-font-lock-keywords | ||
| 6481 | nil nil nil nil | ||
| 6482 | (font-lock-syntactic-face-function | ||
| 6483 | . python-font-lock-syntactic-face-function))) | ||
| 6484 | (setq-local syntax-propertize-function | ||
| 6485 | python-syntax-propertize-function) | ||
| 6486 | (setq-local imenu-create-index-function | ||
| 6487 | #'python-imenu-create-index) | ||
| 6488 | (add-hook 'which-func-functions #'python-info-current-defun nil t)))) | ||
| 6489 | 6489 | ||
| 6490 | ;;; Completion predicates for M-x | 6490 | ;;; Completion predicates for M-x |
| 6491 | ;; Commands that only make sense when editing Python code | 6491 | ;; Commands that only make sense when editing Python code |