Using AllegroCL with Emacs

One way is the SLIME way — similar to any other lisp/scheme implementation, install it, set inferior-lisp-program, add (slime-setup '(slime-fancy)) to your .emacs, and run M-x slime. Boom! Done.

There is another way, using an Emacs Lisp connection suggested by Franz (the guys who sell AllegroCL).

You’ll need to add this to your Emacs file (depending on when and what you download, your path may be slightly different):

(load-file "/Applications/AllegroCLexpress.app/Contents/Resources/eli/fi-site-init.el")

This done (and loaded), run fi:common-lisp. The first time you do this, it’ll ask you which buffer name to use (use the suggested default), the host (leave it set to the default, localhost — though this should illustrate how easy a remote session would be!), a process directory (pick some local directory, say ~/lisp/ ?) and paths to the image name and image file, which will correspond to alisp and alisp.dxl respectively, in the app’s directory.

At this point, you should see something like this:

Allegro CL  Emacs
Allegro CL Emacs

Now at this point, it’s a matter of getting comfortable in the environment. Obvious similarities to Slime include the appearance of the function’s argument list once you press space after the name of the function. It might help to think of this as a sort of combination of Slime and Paredit. So for example, C-c ] acts as a “super parenthesis”, adding as many closing parentheses as needed.

Here are a few other “helpers”:

  • M-D => Describe symbol
  • C-c i => Insert the argument list of the function
  • C-c f => Lookup the function reference in a browser (defaults to Safari on OSX)
  • C-c Tab => Autocomplete name under cursor
  • C-c ? => Apropos
  • C-c c => List callers

… and so on. Ultimately, the whole point is just to make writing, running and debugging code easier!

(Disclaimer: this isn’t necessary at all; AllegroCL comes with an IDE (though you’ll need to install X11 to use it). Since I’m used to using Emacs in general and haven’t used an IDE for a while now, this is something I prefer, but everything here is entirely a matter of personal preference!)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s