I am quite new to emacs, but already convinced of the power of this tool.
I would be very interested if you could share some configurations (.el files) or tips that go with super-collider.
I am sure others would be curious as well !
I don’t really know what to add more, if there are additional tweaks that worth it and goes well with it.
Curiously, I systematically have a bug when working in emacs with a .sc file: After calling sclang-start then booting the server, when navigating through a document, the mini buffer throws me an error SCLang: Error in command handler, which only goes away when calling the function sclang-ac-mode (the auto complete mode).
When I add the package sclang-extension, I got other kind of errors when sclang-ac-mode is activated. When I type some code into the buffer, or simply move the cursor around the text, for example
{SinOsc.ar(440);}.play
the post window continuously throws me errors that look like
ERROR: Parse error
in interpreted text
line 1 char 30:
try { Emacs.message((({SinOsc).class).asCompileString) } {|err| err;}
^
-----------------------------------
opening bracket was a '{', but found a ')'
in interpreted text line 1 char 30
ERROR: syntax error, unexpected BADTOKEN, expecting '}'
in interpreted text
line 1 char 30:
try { Emacs.message((({SinOsc).class).asCompileString) } {|err| err;}
^
-----------------------------------
ERROR: Command line parse failed
ERROR: Class not defined.
in interpreted text
line 1 char 37:
try { Emacs.message((Meta_Meta_SinOsc.methods.collect {|m| [m.name, m.argList, m.ownerClass] }).asCompileString) } {|err| err;}
Any idea?
I reduced my configuration in my init.el to these simple lines, and I still get the errors
I did some digging, and found that the those error messages shown in the consol come when either of the following three modes are activated: sclang-ac-mode, sclang-doc-mode, sclang-extensions-mode. It looks like they appear when those modes should enter in action. For example, when finishing typing SinOsc., putting the last dot triggers the following error in the post window:
ERROR: Class not defined.
in interpreted text
line 1 char 37:
try { Emacs.message((Meta_Meta_SinOsc.superclasses).asCompileString) } {|err| err;}
The only solution so far is to disable sclang-extension-mode, and all the other modes.
Just using this thread to revive it and ask a related question.
I played around with emacs and SC today and I got it running, including simple auto completion.
As I want to learn SC I thought it’s a good idea to also get used to emacs (or nvim). Meanwhile I prefer emacs. The configuration of emacs turned out to be simpler in my opinion.
Then I adjusted the paths in my init.el file (see below). In the default configuration the post window was opened on the bottom and with the help of this forum and chatGPT I was able to open it on the right like in scIDE.
The help browser can be opened with C-c h .
For auto completion I installed company with the melpa package manager. This worked out of the box. The init file was adjusted with chatGPT.
Two things I’m currently still missing:
In the default scIDE I get suggestions for the arguments after entering e.g. SinOsc.ar( . Is this also working in emacs? I watched some youtube videos (e.g. https://www.youtube.com/watch?v=n01nAN4I8wM ) and this does not seem to be the case. edit: also this works. With C-c RET it is shown on the bottom of the page.
Is it possible to execute a code block embraced in (…) with one command?
edit: it’s working with C-M-x (Ctrl + Alt + x)
BTW. Installing the emacs extensions from here: GitHub - chrisbarrett/sclang-extensions: UNMAINTAINED made the configuration unusable. This seems to be outdated meanwhile or I just did it wrong. After deleting the package it worked again.
;; ------------------------
;; Package Manager Setup
;; ------------------------
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(package-initialize)
;; Ensure use-package is installed
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(require 'use-package)
;; ------------------------
;; Startup UI
;; ------------------------
(setq inhibit-startup-screen t) ;; disable welcome screen
(setq initial-scratch-message "") ;; empty scratch buffer
;; ------------------------
;; Theme
;; ------------------------
(use-package dracula-theme
:ensure t
:config
(load-theme 'dracula t))
;; ------------------------
;; Company-mode (autocomplete)
;; ------------------------
(use-package company
:ensure t
:hook (after-init . global-company-mode)
:config
(setq company-idle-delay 0.2 ;; show completions after 0.2 sec
company-minimum-prefix-length 1))
;; Configure company for SuperCollider specifically
(add-hook 'sclang-mode-hook
(lambda ()
(company-mode 1)
(setq-local company-backends
'(company-capf company-dabbrev-code))
(setq sclang-autocomplete-enable t)))
;; ------------------------
;; SuperCollider Emacs Integration
;; ------------------------
;; Adjust this path to where you installed the SC Quark 'scel'
(add-to-list 'load-path "~/.local/share/SuperCollider/downloaded-quarks/scel/el")
(require 'sclang)
;; Associate .scd and .sc files automatically
(add-to-list 'auto-mode-alist '("\\.scd$" . sclang-mode))
(add-to-list 'auto-mode-alist '("\\.sc$" . sclang-mode))
;; Move PostBuffer to right side window
(add-to-list 'display-buffer-alist
'("\\*SCLang:PostBuffer\\*"
(display-buffer-in-side-window)
(side . right)
(window-width . 30)))
;; ------------------------
;; Custom-set Variables (generated by Emacs, keep as is)
;; ------------------------
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages '(company dracula-theme use-package)))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
Much of SCEL’s code dates back 20 years, before SCDoc and the help GUI existed.
Modern alternatives like s.makeWindow are great if they fit your workflow.
But SCEL has real value for developers who prefer text editors, and there’s plenty
of room to strengthen it. The core limitation is architectural: OSC is
request-response, so SCEL can only query what it explicitly asks for. Without
built-in callbacks or event-push, real-time reactivity requires constant
polling, which isn’t practical. A proper callback mechanism would significantly
change that. LSP has been discussed since 2018 as a better long-term foundation. @scztt did excellent work on VSCode + LSP support (well-done), which remained active through
at least last year or this year. That’s a promising direction, but it’s a larger undertaking.
In the meantime, there are concrete improvements SCEL can make today with its
current infrastructure:
Better contextual completion — Analyze the scope of a statement as you type
to suggest relevant symbols. Inside a Synth? Show UGens. Calling a method?
Show its signature. This is pure parsing, no polling needed.
On-demand introspection — Hovering or right-clicking triggers a one-off
query: “What methods does this class have?” “Where is it defined?” These work
fine over OSC.
Richer evaluation feedback — Capture and display what sclang
returns—types, values, side effects—inline. Even preview some evaluations
before full execution.
Indexed local cache — Build and update on demand for instant navigation
through classes, methods, and definitions.
Integrated help — Query SCDoc from within the editor, surfacing docs as you
type or on request.
Better synth/server inspection — Display available synths, UGens, buses, and
buffers as interactive lists.
These don’t require those architectural changes — just focused work on what’s already
possible with scel.
Do you use the default keybindings or do you define your own? I find C-c C-s to stop too complicated and would bind it to F12. But I don’t know what’s the best method for this and will F12 then also be shown in the menu?
EDIT: Usually, “ctrl-C” are reserved for users, while “ctrl-X” not. There are some guidelines, but in principle you can do your thing. Just know that you might override another one.
One ergonomic detail that I find somewhat useful is when using shortcuts with Control or Super, use one hand for each key (Control with right hand, and C with left hand, etc). There are also other alternatives, such as pressing Control once and using some tool to “hold” it down. Or you can use “evil-mode,” which uses VIM shortcuts.
I used evil mode for a while, but somehow got crazy, cause it doesn’t work everywhere. I even set my keyboard layout to qwerty for one day, but these were too many changes. I keep emacs mode and qwertz layout for now. Vim I use for quick edits.
Will try the right ctrl key …