View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide

SuperCollider Emacs

Home   How To   Code Pool   Public Library   Theory   Events
The sclang Emacs mode is now in svn, in editors/scel/ to be precise. This directory also contains a README.

Try C-h m when inside SCLang or an sclang-mode buffer to get an overview of the key commands.
They are still not stabilized, so don't despair if a shortcut suddenly does something different after a svn update.

Basic emacs instructions

type C-x o to switch between windows.

type C-x C-f to open an file. choose one of the examples.

In emacs-slang M-x stands for Meta-x, which means either first pressing the ESCAPE key and then 'x', or holding the Alt key pressed and pressing the 'x' key. C-x stands for holding the CTRL key while pressing 'x'.

Test it!

In emacs try to execute these lines (using C-c C-c which executes the line or region) in order to create an SC server, hear some noise and to stop it:
s = Server.local;

SynthDef("mysynth", {, }).play(s); 


The output in the lower part of emacs should look something like this:
a Server

Synth("mysynth" : 1010)

a Server

HTML Help support in Emacs

HTML Help display is realised with the w3m package for Emacs (emacs-w3m)
You must have this package installed, when compiling SCEL.

C-c C-h searches for a help file
C-M-h switches to the Help browser
E copies the buffer, puts it in text mode and sclang-minor-mode, to enable you to edit the code parts to try out variations of the provided code in the help file. With C-M-h you can then return to the Help browser and browse further from the Help file.
C-c C-e allows you to edit the source of the HTML file, for example if you want to improve it and commit it to the repository.

To navigate in the w3m buffer, you probably want to set the following in your
$HOME/.emacs file

(eval-after-load "w3m"
 (define-key w3m-mode-map [left] 'backward-char)
 (define-key w3m-mode-map [right] 'forward-char)
 (define-key w3m-mode-map [up] 'previous-line)
 (define-key w3m-mode-map [down] 'next-line)))

This ensures that the arrow keys are just for moving through the document, and not from hyperlink to hyperlink, which is the default in w3m-mode.

You may also be interested in Emacs Scrollwheel support.

Bracket/Parens autocompletion

You can have autocompletion of the (,{,[ and the " symbols by adding the following to your $HOME/.emacs file

(global-set-key [?{] 'skeleton-pair-insert-maybe)
(global-set-key [?(] 'skeleton-pair-insert-maybe)
(global-set-key [?[] 'skeleton-pair-insert-maybe)
(global-set-key [?"] 'skeleton-pair-insert-maybe)

(setq skeleton-pair t)

One Step Beyond

a small tutorial for customizing scel and working with SC and emacs can be found here. simply download the file, open it in emacs and follow the examples. requirements: a working sclang/emacs installation.


Links to this Page