I already filled a feature request for recognizing derived modes through
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)
(cdr (assoc 'python-mode hs-special-modes-alist)))))
(add-hook 'sage-shell:sage-mode-hook #'my-sage-initialize-hs)
The workaround links the settings for
hs-special-modes-alist to a new entry for
Tested with Emacs 26.3, and
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