Add basic support for hideshow in python-ts-mode (bug#60044)
* lisp/progmodes/python.el (python-base-mode): Add setup for python-ts-mode.
This commit is contained in:
parent
cac070b23e
commit
e8f7ab67ad
1 changed files with 15 additions and 13 deletions
|
@ -6564,19 +6564,21 @@ implementations: `python-mode' and `python-ts-mode'."
|
||||||
(add-function :before-until (local 'eldoc-documentation-function)
|
(add-function :before-until (local 'eldoc-documentation-function)
|
||||||
#'python-eldoc-function))))
|
#'python-eldoc-function))))
|
||||||
|
|
||||||
(add-to-list
|
;; TODO: Use tree-sitter to figure out the block in `python-ts-mode'.
|
||||||
'hs-special-modes-alist
|
(dolist (mode '(python-mode python-ts-mode))
|
||||||
`(python-mode
|
(add-to-list
|
||||||
,python-nav-beginning-of-block-regexp
|
'hs-special-modes-alist
|
||||||
;; Use the empty string as end regexp so it doesn't default to
|
`(,mode
|
||||||
;; "\\s)". This way parens at end of defun are properly hidden.
|
,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-forward-sexp-function
|
||||||
python-hideshow-find-next-block
|
nil
|
||||||
python-info-looking-at-beginning-of-block))
|
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-regexp (python-rx (* space) block-start))
|
||||||
(setq-local outline-level
|
(setq-local outline-level
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue