attempt at ob-sage.el for org-mode (emacs)
I am a big fan of Sage
and of emacs
' org-mode
. I use org-mode
to outline lectures for my students and often need to include evaluatable code inside my org-mode
's BEGIN_SRC
/END_SRC
environment blocks. No problem, I already do this with some languages, such as python
and sh
, but I'd really like to do it with Sage
. Unfortunately, there is no support yet for Sage
, i.e. there's no ob-sage.el
file.
So I tried making my own ob-sage.el
file with some success. I did this by copying the ob-python.el
file that came with my emacs installation, renaming it ob-sage.el
, and then just doing a query-replace
inside, converting every instance of "python" or "py" or "python-mode" into an instance of "sage" or "sage-mode". This works to an extent, but I am not able to get persistent sessions to work. Has anybody attempted this yet? Would anyone like to share their progress?
I would like to upload the ob-sage.el
file I have, but I think it is generally regarded as bad netiquette to upload 300 lines of code to a post on a forum like this. What would be the appropriate/best way to share my ob-sage.el
file here on asksage?
Put it on pastebin. And make sure before submitting on pastebin, the paste expiration is set to "never", so that if someone looks up this question a year later they can still access the code. If you create an account on pastebin, then you can later edit and update the code also later. The other option is to open a github/bitbucket/googlecode account and put your file in github/bitbucket/googlecode. That way every time you update the code, it will be available and also the changes that are effected will be visible to everyone. By the way, I hope you are aware of [sage-mode](http://wiki.sagemath.org/sage-mode). I don't use emacs so I can not say if it is relevant to what you are doing.
A third option is to get a Sage Trac account (see instructions at http://trac.sagemath.org/sage_trac/) and open a ticket there and put the code in a file attached there. I've emailed the maintainer of sage-mode to see if he has any comments.