Running SLIME under Cygwin with ABCL

If Armed Bear Common Lisp may be said to have an IDE, it has one in the combination of Emacs using the SLIME to connect to running Lisp instance(s). In the parlance of SLIME, Emacs is said to be the superior process with the running Lisp instance(s) known as the inferior Lisp process. With SLIME, Emacs provides symbol completion in a REPL with edit history, Lisp syntax highlighting, finding the source location for a given form, the ability to run multiple instances of the inferior Lisp (or even different versions of Lisps), the ability to interactively inspect Lisp values, a nice wrapper for controlling ASDF, and much more.

When confronted with a Microsoft Windows environment that I need to productively generate code within, the first thing I do is install the Cygwin package to get to a minimal UNIX-like environment. Unlike many Windows enhancements, the installation of cygwin does not require Administrator privileges so it is possible even in a somewhat restricted corporate environment. cygwin provides a UNIX compatibility layer that has enabled the porting of many standard GNU utilities to run under Windows, including an X11 server.

One of the first packages that I install for use under Cygwin is the Emacs X11 package, which provides The One True editor with a lot of tools that make simple programmatic tasks easy, and the construction of complicated system possible. Historically there have been other efforts to bring Emacs to Windows such as NTEmacs, but now that GNU Emacs 24.1 runs fine in an X11 server with cygwin, I think the ease by which cygwin installs and updates outweighs putative advantages of Windows-specific Emacs ports. In truth, over time, GNU Emacs has absorbed most of the useful features pioneered by other, more native, versions.

HOWTO install SLIME under Windows for ABCL

  1. Install cygwin, selecting the 'emacs-x11' and 'git' packages in the interactive chooser.
  2. Make a directory called c:\work to contain ABCL and SLIME. You can of course use whatever directory you wish here, but the adjust the rest of these instructions to whatever you choose. Under cygwin, this directory will appear as /cygdrive/c/work.
  3. Install ABCL under c:\work\abcl, so that c:\work\abcl\abcl.bat invokes ABCL.
  4. Use Git to retrieve a copy of SLIME.
  5. From the bash prompt you installed in the first step, change to the the /cygdrive/c/work directory issue the following command:
      cmd$ git clone https://github.com/slime/slime.git
    
    This will checkout a copy of SLIME including documentation. Alternatively one may download a CVS snapshot but then it will be harder to update SLIME later if you wish.
  6. Use Emacs to edit ~/.emacs to contain the code contained in slime-cygwin.el. This code sets up SLIME to be autoloaded by Emacs, using the cygpath.exe executable to translate pathnames between the Cygwin UNIX conventions (which Emacs expects), and the native conventions (which ABCL running on the JVM expects).
  7. Upon evaluating the elisp code which you just used to configure SLIME (which can be affected by restarting Emacs), SLIME can be invoked via M-x slime. ABCL will be invoked as a separate process, it will compile the elisp server known as swank that communicates between Emacs and the inferior Lisp process, it will load that code to initiate a connection, you'll see some "flying letters" coalesce into a REPL with a message in the mini-buffer welcoming you to SLIME.

History

The network location, http://slack.net/~evenson/abcl/slime-under-cygwin.html, serves as the canonical instructions for getting SLIME to translate pathnames under Cygwin, superseding the instructions posted at http://abcl-dev.blogspot.com/2010/05/running-slime-under-cygwin-with-abcl.html which were invalidated by changes of 2011-12-24 to the way SLIME invokes the inferior Lisp image.