[chuck-users] emacs, and other editors for chuck

Stephen Sinclair radarsat1 at gmail.com
Tue Sep 9 16:56:02 EDT 2008

On Tue, Sep 9, 2008 at 10:29 AM, Kassen <signal.automatique at gmail.com> wrote:
> Stephen Sinclair;
>> I don't use it (emacs ftw!)
> Would you have the time to share some of your thoughts on the advantages of
> emacs for ChucKing? I looked at it but it's quite a daunting editor and I'd
> like to know a bit about the potential gains before investing time in it.

Hm, let's see.
_mainly_ I use emacs because i'm used to it.  I use it for coding, and
my fingers know the shortcuts, and it just works for me.  I've tried
to get used to vim, for example, and just can't seem to do it.  This
goes for any editor, of course: use what you know, and what you like.
I'm not on any mission to make people use specific software, I can't
only make recommendations.
However, there are some virtues, I think that deserve mention.  (Some
of these will of course be available in other programs.)

One, is that emacs has "windows".  You can drop a shell into one
window, an editor into another, and a status window into a third.  You
can split the screen in any desireable way.

Two, is that I have F6 configured for "compile", which gives me a
one-liner shell command, and F7 for "recompile", which just repeats
whatever the last compile command was.  This is insanely useful for
chucking, because you can hit F6 and tell chuck to load your script,
and then take note of which shred ID it got, and use the '=' command
to replace it the next time.  Then just edit and keep hitting F7.

On top of that, emacs has really good search & replace and regexp
support.  (I use the former more than the latter.)  Which I have
configured to Ctrl-A on my keyboard so that's a really fast thing to
do.  Then I can switch between files by hitting Ctrl-B and typing the
first few letters of the file name and then Tab (if i've loaded it
already) or load or create a new file with Ctrl-F.  The filename
completion rocks.

Lastly, it's completely programmable with lisp.  So if I wanted I
could probably make it way more intelligently communicate with ChucK,
interpreting its error messages among other things.  But I don't have
the patience for that.  :)

One thing that I sorely miss is the ability to automatically track
which shred IDs get assigned to which files, for when I want to remove
or replace a shred.  However I think this is also partly the fault of
ChucK which can't be bothered to tell me this information in a useful
way, since it doesn't differentiate between files and sporks.  But I'd
love to be able to remove or replace a shred by *name* instead of by
some number that I have to look way back in the buffer to find.  (But
of course Ctrl-S-S "search" is pretty quick for this.)

All in all I don't have to take my hand off the keyboard, which is
particularly nice.

As for it being a daunting editor, I really only use a handful of
commands, though of course it's capable of much more.

>> but I just tried to compile it quickly and
>> it failed, so I can't help directly.
> Hmmm. I found the Mini quite easy to compile, at least since there is a
> clear list of all that you need for it, on top of ChucK's dependencies.

Yeah I don't know why it didn't work.  But I haven't taken the time to
figure it out.  Probably something small.

> I just wish it would have a more intelligent "replace" function for shreds
> then always replacing the last one that was run. It's nice and simple, I
> like that. There are hotkeys for running code though not enough for editing
> it. emacs will solve all of those issues, I'm sure but that would go at the
> expense of the simplicity?

I'd love to program some emacs lisp, or some other mechanism, to track
which shreds have been loaded.  Something that would give super-quick
keyboard access to remove or replace specific shreds.  Perhaps Tab
completion would be good for this.

By the way, with all this talk about emacs, I should really specify,
honestly, that I really only have a very short beard.  And no, I don't
wear sandles.  ;-)


More information about the chuck-users mailing list