2013-06-29 17:13:38 +00:00
# Scel
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
SuperCollider/Emacs interface
## Installation requirements
2009-01-02 19:06:25 +00:00
For the HTML help system, you will need emacs-w3m support.
2013-06-29 17:13:38 +00:00
## Installation (default)
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
By default emacs-lisp files are installed in
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
`$prefix/share/emacs/site-lisp`
2009-01-02 19:06:25 +00:00
SuperCollider files are put in
2013-06-29 17:13:38 +00:00
`$prefix/share/SuperCollider/Extensions/scel`
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
The only thing you need to do is loading the sclang interface in your `~/.emacs`:
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
```lisp
2009-01-02 19:06:25 +00:00
(require 'sclang)
2013-06-29 17:13:38 +00:00
```
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
For the HTML help system to fully function also add
```lisp
2009-01-02 19:06:25 +00:00
(require 'w3m)
2013-06-29 17:13:38 +00:00
```
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
## Installation (detailed)
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
Put all `*.el` files in emacs' load-path. e.g. if you put them in
`~/emacs/`, add the following lines to `~/.emacs` (or whatever your init
2009-01-02 19:06:25 +00:00
file is called):
2013-06-29 17:13:38 +00:00
```lisp
2009-01-02 19:06:25 +00:00
(add-to-list 'load-path "~/emacs")
(require 'sclang)
2013-06-29 17:13:38 +00:00
```
2009-01-02 19:06:25 +00:00
for the HTML help system to fully function also add
2013-06-29 17:13:38 +00:00
```lisp
2009-01-02 19:06:25 +00:00
(require 'w3m)
2013-06-29 17:13:38 +00:00
```
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
now put all `*.sc` files in sclang's library path, e.g. if you put them
in a non-standard location, such as `~/SuperCollider/Emacs`, add the
following to `~/.config/SuperCollider/sclang.conf.yaml`:
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
```yaml
includePaths:
[~/SuperCollider/Emacs]
```
2009-01-02 19:06:25 +00:00
(note normally this is not needed as they are put into sclang's library
path during installation with scons).
2013-06-29 17:13:38 +00:00
## Usage
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
In order to automatically start sclang when invoking emacs, use the following command line:
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
```bash
$> emacs -sclang
```
2009-01-02 19:06:25 +00:00
you're now ready to edit, inspect and execute sclang code!
2013-06-29 17:13:38 +00:00
# Getting help
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
Inside an sclang-mode buffer (e.g. by editing a .sc file), execute
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
`C-h m`
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
and a window with key bindings in sclang-mode will pop up.
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
`C-x C-h` lets you search for a help file
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
`C-M-h` opens or switches to the Help browser (if no Help file has been opened, the default Help file will be opened).
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
`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.
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
`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.
2009-01-02 19:06:25 +00:00
To enable moving around in the help file with arrow keys add the following
2013-06-29 17:13:38 +00:00
in your `~/.emacs`:
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
```lisp
2009-01-02 19:06:25 +00:00
(eval-after-load "w3m"
'(progn
(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)))
2013-06-29 17:13:38 +00:00
```
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
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.
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
## Customization
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
To fine-tune the installation from within emacs' graphical customization interface, type:
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
`M-x sclang-customize`
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
In particular, you will have to customize `sclang-runtime-directory'.
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
## Server control
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
In the post buffer window, right-click on the server name; by default the two servers `internal` and `localhost` are available. You will get a menu with common server control operations.
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
To select another server, step through the server list by left-clicking on the server name.
2009-01-02 19:06:25 +00:00
2013-06-29 17:13:38 +00:00
Servers instantiated from the language will automatically be available
in the mode line.