I already filled a feature request for recognizing derived modes through hideshow
.
Until this feature request is handled you can use the following workaround in your init file:
(defun my-sage-initialize-hs ()
"Initialize `hs-special-mode-alist' for `sage-shell:sage-mode'.
Note: Function `python-mode' must be run at least once to make this work."
(unless (assoc 'sage-shell:sage-mode hs-special-modes-alist)
(add-to-list 'hs-special-modes-alist
(cons 'sage-shell:sage-mode
(cdr (assoc 'python-mode hs-special-modes-alist)))))
(hs-minor-mode))
(add-hook 'sage-shell:sage-mode-hook #'my-sage-initialize-hs)
The workaround links the settings for python-mode
in hs-special-modes-alist
to a new entry for sage-shell-mode
.
Tested with Emacs 26.3, and sage-shell-mode-20191103.1040
.
When the feature request is accepted and built into hideshow.el
you do not need that workaround anymore since sage-shell-mode
is really derived from python-mode
.