aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorYuan Fu2022-12-15 17:16:28 -0800
committerYuan Fu2022-12-15 17:16:28 -0800
commite8f7ab67ad18063155f6a7ba14a29e3679dc1e76 (patch)
treea8913d7445bbd8be66590c2818d03fb0ff774858 /lisp/progmodes/python.el
parentcac070b23e4d555a194d67c3a842fad81285df72 (diff)
downloademacs-e8f7ab67ad18063155f6a7ba14a29e3679dc1e76.tar.gz
emacs-e8f7ab67ad18063155f6a7ba14a29e3679dc1e76.zip
Add basic support for hideshow in python-ts-mode (bug#60044)
* lisp/progmodes/python.el (python-base-mode): Add setup for python-ts-mode.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el28
1 files changed, 15 insertions, 13 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index ee05862550d..a10359b384a 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -6564,19 +6564,21 @@ implementations: `python-mode' and `python-ts-mode'."
6564 (add-function :before-until (local 'eldoc-documentation-function) 6564 (add-function :before-until (local 'eldoc-documentation-function)
6565 #'python-eldoc-function)))) 6565 #'python-eldoc-function))))
6566 6566
6567 (add-to-list 6567 ;; TODO: Use tree-sitter to figure out the block in `python-ts-mode'.
6568 'hs-special-modes-alist 6568 (dolist (mode '(python-mode python-ts-mode))
6569 `(python-mode 6569 (add-to-list
6570 ,python-nav-beginning-of-block-regexp 6570 'hs-special-modes-alist
6571 ;; Use the empty string as end regexp so it doesn't default to 6571 `(,mode
6572 ;; "\\s)". This way parens at end of defun are properly hidden. 6572 ,python-nav-beginning-of-block-regexp
6573 "" 6573 ;; Use the empty string as end regexp so it doesn't default to
6574 "#" 6574 ;; "\\s)". This way parens at end of defun are properly hidden.
6575 python-hideshow-forward-sexp-function 6575 ""
6576 nil 6576 "#"
6577 python-nav-beginning-of-block 6577 python-hideshow-forward-sexp-function
6578 python-hideshow-find-next-block 6578 nil
6579 python-info-looking-at-beginning-of-block)) 6579 python-nav-beginning-of-block
6580 python-hideshow-find-next-block
6581 python-info-looking-at-beginning-of-block)))
6580 6582
6581 (setq-local outline-regexp (python-rx (* space) block-start)) 6583 (setq-local outline-regexp (python-rx (* space) block-start))
6582 (setq-local outline-level 6584 (setq-local outline-level