# Using SLIME with Allegro Common Lisp

## What is SLIME?

SLIME stands for the Superior Lisp Interaction Mode for Emacs. It is a development environment for writing Lisp applications that is compatible with most available Lisp implementations. It is favorable for developers writing code to multiple Lisp implementations as it provides a similar development experience regardless of the Lisp being used.

There is a SLIME home page as well as a SLIME CLiki if you want to read more about the interface and the features it provides.

There are a number of easy ways in which to download and install SLIME. NOTE: the instructions below assume you are running Lisp and Emacs on the same machine. You should visit the SLIME websites referenced above if you wish to set up a different configuration.

• Via quicklisp: follow the instructions to complete the installation, then evaluate
(ql:quickload "quicklisp-slime-helper")
again, follow the directions to complete setup. For Windows users, follow the instructions below in the SLIME setup on Windows section to complete the setup.
• Download via Git. Clone the files to a directory of your choice on the local machine. You'll need to remember this directory for later configuration steps below.

## Configuring SLIME

SLIME consists of two parts, a body of code that runs within Emacs (SLIME), and the SWANK server which runs in the Lisp. SLIME makes use of the inferior-lisp mode in emacs. On unix-like systems, this poses no problem for use with Allegro CL, but under windows, special configuration is required. This code will make SLIME available whenever you start up emacs. The call to slime-setup includes a number of contrib modules that you may find useful when using slime. slime-fancy actually causes a number of contrib modules to be loaded, and slime-banner makes a nice animation at startup. See the contrib/ subdirectory of your SLIME checkout to see what else is available.

### Setup Notes

Setting up slime requires the creation of a couple of files.

Allegro CL Express users: The code segments below are written so that you can copy them directly into the suggested files and have SLIME start working immediately.

Non-Express users: You will need to modify the below code segments to reference the lisp binary that you use for startup. On *nix machines, adjust the binding for inferior-lisp-program, and on windows change the binding of *slime-lisp*.

All Allegro CL users: Due to the multiple ways in which one may configure a Windows box for development work it is difficult to provide a single set of files that will work for all of them. If the setup files don't work as is, please read the commented sections of the below code for suggestions that may address the issue.

### SLIME setup on Unix

The sample code below assumes SLIME is located in /usr/local/slime.

;; update this path to the correct location.

'(progn
(slime-setup '(slime-fancy slime-banner))
(setq slime-complete-symbol*-fancy t)
(setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol)))

;; Optionally, specify the Lisp program you are using. Default is "lisp"
;; If the Allegro directory is not in your PATH environment variable
;; this should be a fully qualified path.
;; choose one of the below based on Express or non-Express usage
;; (setq inferior-lisp-program "alisp")
(setq inferior-lisp-program "allegro-express")


### SLIME setup on Windows

Setting up SLIME on Windows works very similar to the way it works on Unix. SLIME expects a win32 console application (which Allegro CL is not), so you will have to use a different executable as your inferior-lisp-program.

The sample code below assumes Slime has been unzipped to c:/cygwin/usr/local/slime.

First, we create a batch file that will be used to start lisp. This batch file can also be used when setting up the quicklisp-slime-helper on Windows platforms.

For purposes of this example, we'll assume the code in the box below is saved to "c:/start-swank.bat". Use Emacs or another editor to create this file. In Emacs, press the keys Control-x Control-f. You are prompted for a file to open. Enter " c:/.slime.lisp". A buffer will be opened indicating a new file (or an existing file if one already exists). Copy the contents from the box below into the buffer. Enter the keys Control-x Control-s to save the file to disk.

@echo off

if not "%1"=="" goto :start
:noimpl
echo USAGE: start-swank.bat c:\path\to\lisp
echo   This command will read a line of lisp forms to start the swank
echo   server from stdin and start a lisp that runs these forms.
exit 1

:start
set /p swank_command="Enter the commands necessary to start the swank server on one line (slime will do this for you)"

echo Starting swank server in lisp %1...

%1 +B +m -e "%swank_command%"


The next step is to add code to your .emacs file so that SLIME is automatically available whenever you start Emacs.

(push "c:/cygwin/usr/local/slime/" load-path)
(require 'slime)

(slime-setup '(slime-fancy slime-banner))
(global-set-key "\C-cs" 'slime-selector)
(setq slime-complete-symbol*-fancy t)
(setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol)

;; choose one of the below based on Express or non-Express usage
;; (setq inferior-lisp-program "c:/acl82/start-swank.bat c:/acl82/mlisp")
(setq inferior-lisp-program "c:/acl82/start-swank.bat c:/acl82/allegro-express.exe")


## Running SLIME

If your .emacs has been modified with the above code, then you are ready to go. Simply (re-)start emacs and SLIME is ready to be used. Enter 'M-x slime' within emacs and you should be connected to Lisp.

For instructions on using SLIME, we recommend visiting the SLIME homepage as well as the SLIME CLiki. There are many helpful links on both.

## Support

[WinZip problems] If trouble is encountered directly opening tarballs using winzip, try saving the tarball to disk first, then opening the saved file using winzip.

[General] While this page makes reference to slime, note that this is not a Franz Product. Any problems installing or using this software should be directed to the appropriate community. Allegro specific errors related to these packages can be addressed via these entities.