Clementson's Blog

Bits and pieces (mostly Lisp-related) that I collect from the ether.

March 2004
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
Feb  Apr

Using LispWorks Personal with Emacs/SLIME on Windows

Monday, March 15, 2004

In an earlier post, I outlined how to configure Emacs to use SLIME with either Allegro CL, LispWorks, or CLISP on Windows. However, my configuration instructions for LispWorks assumed the commercial versions of the product, not the free Personal version. As I mentioned in the posting: "the LispWorks Personal version doesn't have support for init files. Therefore, it is necessary to manually enter (load "c:/usr/home/.slime.lisp") into LispWorks after it has started". This is inconvenient for people who are trying out LispWorks and want to use Emacs and SLIME. To get around this problem, I've created a basic WSH script that feeds the necessary key strokes to LispWorks to get it to load the ".slime.lisp" startup file. This is a bit of a kludge; however, I couldn't think of a more elegant way to get around the limitations in the LispWorks Personal edition on Windows.

Here are the steps you would need to follow to replicate what I've done:

  1. Follow the steps I outlined in my earlier post to make the required changes to the .emacs file and to create the ".slime.lisp" startup file.
  2. Add the following to your .emacs file for LispWorks Personal (you may need to change the directory location for ".lw-slime.vbs"):
  3. (defun lwp-start ()
      (interactive)
      (shell-command "c:/usr/home/.lw-slime.vbs&"))
  4. If you are using Windows2000 or Windows XP, you will already have the Windows Scripting Host (WSH) on your machine. If you are using a different Windows OS (or don't have WSH on your PC for some reason), you can download WSH from here.
  5. Create a file called ".lw-slime.vbs" (put it in "c:/usr/home/" or whatever directory you specified in step 2 above) with the following contents (you may need to change the dirctory locations and the "WScript.Sleep" values in this script):

  6. 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(5000)

    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}"
To use:
  1. Start LispWorks first with "M-x lwp-start" from Emacs
  2. Start the SLIME connection with "M-x slime-connect RET RET RET" from Emacs
Again, you may need to play around with the "WScript.Sleep" values in the WSH script in order to get this to work properly on your machine as the delay value will vary by PC. Let me know if you have any problems with these instructions.

emacs Copyright © 2005 by Bill Clementson