Arc Development using Emacs on OS X

In case you hadn’t noticed, Paul Graham has released Arc. I think it’s a great start. I enjoyed hacking LSharp, but Arc has to be a great way forward for innovative Lispers. Maybe somebody will port it to Scheme on .NET one day.

This is how I’ve set myself up to start developing Arc programs on my MacBook.

I have Xcode tools and MacPorts already installed.

First I created a directory for all my Arc stuff.


mkdir arc
cd arc

Then I downloaded and built MzScheme


curl -O http://download.plt-scheme.org/bundles/352/mz/mz-352-src-unix.tgz
tar -zxvf mz-352-src-unix.tgz
cd plt/src/
./configure
make
make install

Back to my arc directory


cd ../..

Then I grabbed the code for Arc itself.


curl -O http://ycombinator.com/arc/arc0.tar
tar -xvf arc0.tar

Then I created myself a little shell script in the arc0 subdirectory called arc.sh


#!/bin/sh
cd ~/arc/arc0
~/arc/plt/bin/mzscheme -m -f as.scm

Then I could run an interactive Arc session


rob-blackwells-macbook:arc0 reb$ ./arc.sh
Use (quit) to quit, (tl) to return here after an interrupt.
arc> (prn "hello world")
hello world
"hello world"
arc>

Great, but I really need an editor and a way of interacting with the REPL. Enter Emacs and Inferior Lisp Mode.

I put the following in my ~/.emacs file


(show-paren-mode t)
(setq inferior-lisp-program "~/arc/arc0/arc.sh")

Hey Presto, now when I start Emacs I can type:


M-x run-lisp

I can edit an Arc program in another buffer and set it to lisp-mode


M-x lisp-mode

I get bracket matching and colour highlighting.

I can send expressions from my edit buffer to Arc running as the inferior Lisp process using


C-x C-e

Happy days!

Comments are closed.