I often use Sagemath within Org mode for my math notes, using the
ob-sagemath package. Sage can provide an interface to many underlying
interpreters, like GAP or Maxima, and I just figured out how to access
these environments for single lines using `%` magic methods. So for
example if I now need to run a single line in a PARI/GP interpreter
from an org file, I can type:

#+begin_src sage
%gp primepi(666)
#+end_src

and get the result in my org buffer.

I would like to have the ability to do something similar with
multiline scripts, since Sage also provides interfaces for multiple
lines via `%%` methods. When I try to use e.g. the one for R I get
`UsageError: Line magic function `%%R` not found.`

I unfortunately don't yet know enough elisp to get ob-sagemath to do
this, so I'd appreciate any help getting these magic methods to work,
or finding alternatives. Such an extension would let Babel support
dozens more languages and programs without needing more packages, so I
think this could be a valuable addition for many other Emacs users as
well.

Reply via email to