Setting Up SLIME for Win32 CL Implementations
Sunday, July 4, 2004
I've posted (have a look here, here, and here) a number of different times about setting up SLIME for different Win32 implementations and I sometimes get emails from people asking for help in getting things set up properly. So, I've decided to try to write up some definitive instructions so that I can just point people to this posting. I did a similar effort a while back for the CL Cookbook, but that was before SLIME was available. The main complaint that I got about the CL Cookbook page was that it was too complicated. Therefore, I've decided to be very "minimalist" in this set of instructions while still covering the major CL implementations that are available on Win32:
- Franz Allegro CL (same setup for both the commercial and personal versions)
- GNU CLISP
- Xanalys LispWorks - (different setup for the commercial and personal versions)
- Home directory: c:/home/
- Binary installation directory: c:/bin/
- Install Emacs (duh). These instructions assume basic familiarity with Emacs and are known to work with GNU Emacs version 21.3
- Download and install one or more of the above CL
implementations. Install them in the c:/bin/ directory with the
following directory names:
- ACL: C:/bin/acl-6.2
- CLISP: C:/bin/clisp-2.33
- LispWorks: C:/bin/lispworks-4.3
- Download the latest SLIME tarball and unzip it in c:/home/site - make sure you preserve directory names so that you wind up with slime in c:/home/site/slime
- Create a Lisp/SLIME initialization file called .slime.lisp in your c:/home directory and put the following in it:
- If you are using the commercial LispWorks product (either
Professional Edition or Enterprise Edition), you should set
up a console version of LispWorks in order to use it "natively"
inside of Emacs. In order to do this, do the following two
steps:
- Create a lisp file called console.lisp in your c:/ root directory with the following contents:
- Create a Windows batch file called buildlw.bat in your c:/ directory with the following contents:
- Change to the c:/ directory and run the buildlw.bat file. A new LispWorks executable called lispworks-4307.exe will be created in the c:/bin/lispworks-4.3 directory.
(load-all-patches) (save-image "lw4307-console" :console t :restart-function 'mp:initialize-multiprocessing :environment nil) (quit)cd c:\bin\lispworks-4.3\ lispworks-4300 -init c:\console.lisp
- If you are using the free Lispworks Personal Edition (or if you are using the commercial LispWorks product and want to have both the LW IDE and SLIME available), you will need a script that loads the required SLIME support as the free version of LW doesn't support initialization files. Therefore, create a script file called .lw-slime.vbs in your c:/home directory with the following contents:
- Create a .emacs file with the following contents in your c:/home directory:
(load "c:/home/site/slime/swank-loader.lisp") #+lispworks (mp:initialize-multiprocessing) (swank::create-swank-server 4005)
Dim Wsh
Set Wsh = Wscript.CreateObject("Wscript.Shell")
rem Start up LispWorks
wsh.Run("C:\bin\lispworks-4.3\lispworks-personal-4300")
rem Wait for a few seconds for it to start
WScript.Sleep(8000)
rem Press the OK button on the splash screen
Wsh.AppActivate "Upgrade LispWorks"
Wsh.SendKeys "{ENTER}"
rem Load the SLIME startup code
Wsh.AppActivate "LispWorks Personal Edition 4.3.6"
str = "load " & """c:/usr/home/.slime.lisp"""
WScript.Sleep(100)
Wsh.SendKeys (str)
Wsh.SendKeys "{ENTER}"
WScript.Sleep(100)
rem Toggle back to Emacs
Wsh.SendKeys "%{TAB}"
;;__________________________________________________________________________ ;;;; Site-specific locations (defvar home-dir "c:/home/") (defvar bin-dir "c:/bin/")
;;__________________________________________________________________________ ;;;; Programming - Common Lisp (setq load-path (append (list (concat home-dir "") (concat home-dir "site/slime") (concat home-dir "site")) load-path)) (require 'slime) (require 'font-lock) (global-font-lock-mode t)
;; Specify modes for Lisp file extensions (setq auto-mode-alist (append '(("\.lisp$" . lisp-mode) ("\.lsp$" . lisp-mode) ("\.cl$" . lisp-mode) ("\.asd$" . lisp-mode) ("\.system$" . lisp-mode)) auto-mode-alist))
;; Hooks into lisp mode (add-hook 'lisp-mode-hook (lambda () (slime-mode t) (define-key lisp-mode-map [(control j)] 'newline) (define-key lisp-mode-map [(control m)] 'newline-and-indent) (set (make-local-variable lisp-indent-function) 'common-lisp-indent-function)))
(add-hook 'inferior-lisp-mode-hook (lambda () (inferior-slime-mode t))) (slime-autodoc-mode)
(defun replace-slime-cmd () "Replaces regular Slime command for ACL and LW Personal." (interactive) (defun slime () "Start Slime without an inferior lisp." (interactive) (slime-connect "localhost" 4005)))
;; Franz Allegro Common Lisp (defun acl () (interactive) (shell-command (concat bin-dir "acl-6.2/alisp.exe" " +B +cm -L " home-dir ".slime.lisp&")) (delete-other-windows) (replace-slime-cmd))
;; GNU CLISP (defun clisp () (interactive) (setq inferior-lisp-program (concat bin-dir "clisp-2.33/full/lisp.exe" " -B " bin-dir "clisp-2.33/full/" " -M " bin-dir "clisp-2.33/full/lispinit.mem" " -ansi -q")) (load "slime"))
;; Xanalys LispWorks (defun lw () (interactive) (setq inferior-lisp-program (concat bin-dir "lispworks-4.3/lw43-console.exe" " -init " home-dir ".slime.lisp")) (load "slime"))
;; Xanalys LispWorks Personal (defun lwp () (interactive) (shell-command (concat home-dir ".lw-slime.vbs&")) (delete-other-windows) (replace-slime-cmd))
M-x clisp followed by: M-x slimeAlternatively, if you just use a single CL implementation all the time, just put one of the following statement in your .emacs file (after the rest of the above statements):
(acl) (clisp) (lw) (lwp)Then you just do "M-x slime" to run SLIME with your CL implementation. Read the SLIME documentation to learn about the features and functionality. The CLiki pages on SLIME also have some good information.
That's it - good luck and enjoy using SLIME!

