diff --git a/README.org b/README.org index 119c443..232c880 100644 --- a/README.org +++ b/README.org @@ -1,4 +1,7 @@ #+TITLE: ob-sclang +#+STARTUP: showall +#+STARTUP: showstars + ** Why do I even? [[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. ** How to install? @@ -23,6 +26,11 @@ well, then you type a block like this one: #+END_SRC And after you hit /C-c C-c/ you should see the string appear in your =SCLang:PostBuffer*= +*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=. + + +*** Use of variables + You can also include variables to be passed to you sclang code: #+BEGIN_SRC org ,#+BEGIN_SRC sclang :var boo="hoo" :var pi=3.14159 :var year=2000 :var buf='foo @@ -33,7 +41,31 @@ You can also include variables to be passed to you sclang code: ,#+END_SRC #+END_SRC -*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=. +Will reformat your sclang body to: +#+BEGIN_SRC sclang +"hoo".postln; +3.141590.postln; +2000.postln; +"foo".asSymbol.postln; +#+END_SRC +Before passing it on to the sclang process. + +The use of sclang's own global variables is persistent between code blocks so =~boo= + +#+BEGIN_SRC org + ,#+BEGIN_SRC sclang + ~boo = "hoo"; + ,#+END_SRC +#+END_SRC + +is accessible here: + +#+BEGIN_SRC org +,#+BEGIN_SRC sclang + ~boo.postln; +,#+END_SRC +#+END_SRC + ** Known issues 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: