[[https://orgmode.org/][Org-mode]] makes [[http://literateprogramming.com/][literate programming]] easy via [[https://orgmode.org/worg/library-of-babel.html][Library of Babel]]. Il simply allows to mix text with executable /code blocks/ (which can also be extracted (/tangled/) into separate, executable files. The beauty the Library of Babel implementation in org-mode lies in the fact that it supports many languages. I craved support for [[https://github.com/supercollider/supercollider][SuperCollider]] and craving became an itch when I needed to document a working pipeline alternating between executing sclang and shell scripts. I scratched an itch with this little module.
First of all, you will need emacs and SuperCollider (with emacs support) installed. Modern emacsen (>25) and Spacemacs come with bundled org-mode. At this point I am the sole user of this plugin and have just written it so I am not itching yet for MELPA or inclusion in the official org-mode repositories, so installation is manual. You can either drop [[file:ob-sclang.el]] somewhere in your Emacs' path or add its containing directory to ~load-path~ in =.init= file:
*Note:*, that if you have not already started SuperCollider process, the plugin will do it for you as soon as you create a source block of type =sclang=.
At this point, this plugin has a very crude functionality. It allows unidirectional control of SuperCollider process running inside Emacs. As such, here is a list of issues:
- sclang process has a tendency to replace Emacs frames with =Workspace= and =PostBuffer= when it lunches, therefore if have not already started sclang, your code block with start it for you, but your current buffer will loose focus.
- The code you execute will not return anything back to the document you are working in (well, it just prints back all lines it executed so simply use =:results none= to limit the noise.