GNU Emacs, SLIME, Allegro

For some reason, I decided that I just had to switch to GNU Emacs from XEmacs on my WinXP laptop. So I went and downloaded Emacs 22.1 for Windows and installed it.

Setting it up for Erlang was easy: I added this to C:\Documents and Settings\Parijat\.emacs:

;; Erlang:
;; Add the location of the elisp files to the load-path
(setq load-path (cons "C:/erl5.5.4/lib/tools-2.5.4/emacs" load-path))
;; set the location of the man page hierarchy
(setq erlang-root-dir "c:/erl5.5.4")
;; add the home of the erlang binaries to the exec-path
(setq exec-path (cons "c:/erl5.5.4/bin" exec-path))
;; load and eval the erlang-start package to set up everything else
(require 'erlang-start)

Now, to setup Common Lisp. I use Allegro CL 8.0 Free Express Edition. (Yes, one day I’ll buy the full version and repay Franz, but only after getting myself Lisp Certified ;-)) I was following the instructions at and .

This is what I did:

1. Opened up ACL and loaded asdf into it:

International Allegro CL Free Express Edition
8.0 [Windows] (Aug 17, 2007 22:59)
Copyright (C) 1985-2006, Franz Inc., Oakland, CA, USA. All Rights Reserved.

This development copy of Allegro CL is licensed to:
Trial User

CG version / IDE version
Loaded options from C:\Documents and Settings\Parijat\My Documents\

;; Optimization settings: safety 1, space 1, speed 1, debug 2.
;; For a complete description of all compiler switches given the current optimization settings

[changing package from "COMMON-LISP-USER" to "COMMON-GRAPHICS-USER"]
CG-USER(1): (require :asdf)
; Fast loading C:\Program Files\acl80-express\code\ASDF.001

2. Then, downloaded asdf-install and unpacked it into “C:\Documents and Settings\Parijat\asdf-install” (the source tarball has several nested directories called asdf-install; the innnermost contains the .asd file, and that’s the one I am referring to here).

3. Told asdf about this directory:

CG-USER(4): (pushnew "c:/Documents and Settings/Parijat/asdf-install/" asdf:*central-registry* :test #'equal)

and compiled and loaded asdf-install:

CG-USER(5): (asdf:operate 'asdf:compile-op 'asdf-install)
CG-USER(6): (asdf:operator 'asdf:load-op 'asdf-install)

4. Well, all this stuff was in the end to get SLIME. I went to and found the link to the latest SLIME. Now, on Windows, it seems asdf-install can’t download and install tarballs off net (at least on Allegro CL). Then I downloaded and put the slime tarball in C:\Temp. Then:

(setq asdf-install::*verify-gpg-signatures* nil)
(setq *cygwin-bash-program* "c:/cygwin/bin/bash.exe")

and then:

CG-USER(7): (asdf-install:install "C:/Temp/slime-2.0.tgz")

This did not work, complaining:

Warning: Cannot find tar command "C:\\PROGRA~1\\Cygwin\\bin\\bash.exe".
Error: Unable to extract tarball C:/Temp/slime-2.0.tgz.

It seems my mod to *cygwin-bash-program* did not take effect inside asdf. Wonder why. I even quit Allegro, restarted it, defined *cygwin-bash-program* before compiling and loading asdf-install. No luck. (One thing I did not try was to define asdf-install:*cygwin-bash-program* instead of vanilla *cygwin-bash-program*). So I just went and hardcoded tar-command() in installer.lisp to return “C:\\cygwin\\bin\\bash.exe”.

Now the above command works.

5. The Franz documentation instructs me to start “mlisp.exe” or “alise.exe” LISP image (see next step). But my ACL 8.0 express did not come with these images; it only has “allegro-ansi.exe”. So, following the README in the acl80-express directory, I create the images, by starting allegro-ansi.exe, and in the “Debug window”, typing the following:

CG-USER(1): (build-lisp-image "sys:mlisp.dxl" :case-mode :case-sensitive-lower
:include-ide nil :restart-app-function nil
:restart-init-function nil)
CG-USER(2): (sys:copy-file "sys:allegro-ansi.exe" "sys:mlisp.exe")

Now, I have a mlisp.exe and mlisp.dxl. Sure enough, clicking on mlisp.exe launches a console LISP without the GUI.

6. Now I have to load slime into Emacs. According to the instructions on the Franz webpage, I created a file “C:\Documents and Settings\Parijat\.slime.lisp”, with the contents:

(load "C:/Documents and Settings/Parijat/.asdf-install-dir/site/slime-2.0/swank-loader.lisp")

(sys:with-command-line-arguments (("p" :short port :required)
("ef" :long ef :required))
(swank::create-server :port (parse-integer port :junk-allowed nil)
:style :spawn
:dont-close t
:coding-system (or ef "latin-1")))

and added this to my .emacs:

;; Allegro LISP + SLIME
(push "c:/Documents and Settings/Parijat/.asdf-install-dir/site/slimw-2.0/" load-path)
(require 'slime)

(setq slime-multiprocessing t)
(setq *slime-lisp* "C:/Program Files/acl80-express/mlisp.exe")
(setq *slime-port* 4006)

(defun slime ()
(print "this is my slime")
(format "%s +B +cm -L \"c:/Documents and Settings/Parijat/.slime.lisp\" -- -p %s --ef %s &"
*slime-lisp* *slime-port*
(while (not (ignore-errors (slime-connect "localhost" *slime-port*)))
(sleep-for 0.2)))

I restart emacs. I say “M-x slime”. And wait. The mlisp.exe window shows up, but no connection.

I figure that the problem is in (swank:create-server :port …) which is supposed to start the swank server, does not work. If I run it in the mlisp.exe window, the command does not return (okay, maybe it is not supposed to). I can’t telnet to port 4006 on the localhost, though.

Puff!!! It used to be simpler.

Post a comment or leave a trackback: Trackback URL.

Leave a Reply

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

You are commenting using your 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

%d bloggers like this: