diff options
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index f73a0128b5c..f34fb28826f 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -7355,24 +7355,15 @@ implementations: `python-mode' and `python-ts-mode'." | |||
| 7355 | #'python-eldoc-function)))) | 7355 | #'python-eldoc-function)))) |
| 7356 | (eldoc-add-command-completions "python-indent-dedent-line-backspace") | 7356 | (eldoc-add-command-completions "python-indent-dedent-line-backspace") |
| 7357 | 7357 | ||
| 7358 | (add-to-list | 7358 | (setq-local hs-block-start-regexp python-nav-beginning-of-block-regexp) |
| 7359 | 'hs-modes-alist | 7359 | ;; Use the empty string as end regexp so it doesn't default to |
| 7360 | `(python-mode | 7360 | ;; "\\s)". This way parens at end of defun are properly hidden. |
| 7361 | (start . ,python-nav-beginning-of-block-regexp) | 7361 | (setq-local hs-block-end-regexp "") |
| 7362 | ;; Use the empty string as end regexp so it doesn't default to | 7362 | (setq-local hs-c-start-regexp "#") |
| 7363 | ;; "\\s)". This way parens at end of defun are properly hidden. | 7363 | (setq-local hs-forward-sexp-func #'python-hideshow-forward-sexp-function) |
| 7364 | (end . "") | 7364 | (setq-local hs-find-block-beginning-func #'python-nav-beginning-of-block) |
| 7365 | (c-start . "#") | 7365 | (setq-local hs-find-next-block-func #'python-hideshow-find-next-block) |
| 7366 | (forward-fn . python-hideshow-forward-sexp-function) | 7366 | (setq-local hs-looking-at-block-start-p-func #'python-info-looking-at-beginning-of-block) |
| 7367 | (find-beg-fn . python-nav-beginning-of-block) | ||
| 7368 | (find-next-fn . python-hideshow-find-next-block) | ||
| 7369 | (look-start-fn . python-info-looking-at-beginning-of-block))) | ||
| 7370 | |||
| 7371 | (add-to-list | ||
| 7372 | 'hs-modes-alist | ||
| 7373 | '(python-ts-mode | ||
| 7374 | (treesit-things . (or defun sexp)) | ||
| 7375 | (adjust-end-fn . python-ts-hs-adjust-block-end-fn))) | ||
| 7376 | 7367 | ||
| 7377 | (setq-local outline-regexp (python-rx (* space) block-start)) | 7368 | (setq-local outline-regexp (python-rx (* space) block-start)) |
| 7378 | (setq-local outline-level | 7369 | (setq-local outline-level |
| @@ -7446,6 +7437,9 @@ implementations: `python-mode' and `python-ts-mode'." | |||
| 7446 | (setq-local forward-sexp-function #'treesit-forward-sexp | 7437 | (setq-local forward-sexp-function #'treesit-forward-sexp |
| 7447 | treesit-sexp-thing 'sexp) | 7438 | treesit-sexp-thing 'sexp) |
| 7448 | 7439 | ||
| 7440 | (setq-local hs-treesit-things '(or defun sexp)) | ||
| 7441 | (setq-local hs-adjust-block-end #'python-ts-hs-adjust-block-end-fn) | ||
| 7442 | |||
| 7449 | (setq-local syntax-propertize-function #'python--treesit-syntax-propertize) | 7443 | (setq-local syntax-propertize-function #'python--treesit-syntax-propertize) |
| 7450 | 7444 | ||
| 7451 | (python-skeleton-add-menu-items) | 7445 | (python-skeleton-add-menu-items) |