Open Poetastrophe opened 6 years ago
I am not familiar with mmm-mode
but the following code seems to work to some extent:
(require 'mmm-auto)
(setq mmm-global-mode 'maybe)
(let ((envs '("sageblock" "sagesilent")))
(mmm-add-classes
`((latex-sage
:submode sage-shell:sage-mode
:face mmm-default-submode-face
:front ,(rx-to-string
`(and "\\begin{" (or ,@envs) "}" eol))
:back ,(rx-to-string
`(and "\\end{" (or ,@envs) "}" eol))))))
(mmm-add-mode-ext-class 'latex-mode nil 'latex-sage)
Unfortunately syntax highlighting in example.tex is broken with this configuration. I guess the method used by org-mode
better than mmm-mode
. Perhaps I should examine how org-mode
highlights source blocks.
I was looking into how I could get sage-shell:sage-mode to work in sageblock and sagesilent environments. I found this post about getting python-mode to work in specific environments. https://emacs.stackexchange.com/questions/20136/pythontex-and-auctex#20150 But I honestly do not know how to implement this correctly for sage-shell:sage-mode. But I thought it would be neat for working with math-documents.