[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-29 e8f7ab67ad 1/4: Add basic support for hideshow in python-ts-mod
From: |
Yuan Fu |
Subject: |
emacs-29 e8f7ab67ad 1/4: Add basic support for hideshow in python-ts-mode (bug#60044) |
Date: |
Thu, 15 Dec 2022 20:47:21 -0500 (EST) |
branch: emacs-29
commit e8f7ab67ad18063155f6a7ba14a29e3679dc1e76
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>
Add basic support for hideshow in python-ts-mode (bug#60044)
* lisp/progmodes/python.el (python-base-mode): Add setup for
python-ts-mode.
---
lisp/progmodes/python.el | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index ee05862550..a10359b384 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -6564,19 +6564,21 @@ implementations: `python-mode' and `python-ts-mode'."
(add-function :before-until (local 'eldoc-documentation-function)
#'python-eldoc-function))))
- (add-to-list
- 'hs-special-modes-alist
- `(python-mode
- ,python-nav-beginning-of-block-regexp
- ;; Use the empty string as end regexp so it doesn't default to
- ;; "\\s)". This way parens at end of defun are properly hidden.
- ""
- "#"
- python-hideshow-forward-sexp-function
- nil
- python-nav-beginning-of-block
- python-hideshow-find-next-block
- python-info-looking-at-beginning-of-block))
+ ;; TODO: Use tree-sitter to figure out the block in `python-ts-mode'.
+ (dolist (mode '(python-mode python-ts-mode))
+ (add-to-list
+ 'hs-special-modes-alist
+ `(,mode
+ ,python-nav-beginning-of-block-regexp
+ ;; Use the empty string as end regexp so it doesn't default to
+ ;; "\\s)". This way parens at end of defun are properly hidden.
+ ""
+ "#"
+ python-hideshow-forward-sexp-function
+ nil
+ python-nav-beginning-of-block
+ python-hideshow-find-next-block
+ python-info-looking-at-beginning-of-block)))
(setq-local outline-regexp (python-rx (* space) block-start))
(setq-local outline-level