Installing Steelbank Common Lisp and Emacs in Windows

Posted on Sat 05 August 2023 in Blog

It has been awhile since I posted any technical stuff on this site, largely due to time. This is one item I would like to remember, so here goes...

Why this document?

I decided to start learning Common Lisp recently. New users often install portacle, which is a stand-alone package containing Emacs, Steelbank Common Lisp (sbcl), and various bits and pieces to make a stand-alone IDE package. I tried it out, but found all of the extra features got in the way of using emacs in the way I was used to. I decided to setup the integration manually, rather than spend a lot of time figuring out how to tweak portacle's emacs setup to my liking. It wasn't hard to to this in Linux, but Windows 10 presented some challenges. This document is about what I learned during the process, so when I need to repeat this setup in the future I don't need to re-learn things.

Applications to Download

There are 2 packages needed for installation; a third one is optional. They are:

  1. Get gnu-emacs and download the latest windows version. I suggest using a mirror to reduce load on the main site. Download the windows installer version - it ends in "installer.exe".
  2. Download Steel Bank Common Lisp windows installer package.
  3. (Optional) Install Kleopatra if you haven't already and use it to verify the Emacs download by downloading the corresponding sigature file for the version of emacs you downloaded.

Install the downloaded packages.

Follow these steps to install emacs and sbcl:

  1. Install emacs using the default prompts. If windows complains that it doesn't know if the package is secure (and you verified it with the signature file, right?), click the "more" drop-down and select Run-Anyway. (I find it interesting that you can install emacs using powershell and chocolat, but installing it manually makes W10 complain.)
  2. Before installing Steel Bank Common Lisp, there is one long-standing bug you need to know about; to use emacs (and slime) integration you cannot have spaces in the sbcl directory path . Installing it to a path like "C:/Utility/sblc" and it will work fine; installing it to "C:/Program Files/sblc" will not. Run the installer and change the path on the installer screen where you can select options.

Run emacs for the First Time.

  1. Launch emacs from the start menu.
  2. Disable the splash screen by clicking on the triangle next to "Inhibit Startup Screen", then toggling the state. Go back to the top and click "Apply and Save".
  3. Open .emacs for editing. Press C-x C-f, erase what is there, type "~/" and hit tab. You should see a .emacs file in the list. Go ahead and type .emacs at the prompt and hit enter. The inital .emacs file with some basic settings should be displayed.
  4. Open a web browser to configure the melpa emacs repository melpa. Copy and paste the sample script you see to the bottom of the .emacs file. Save it with C-x C-s.
  5. Exit and Relaunch emacs.

Install Superior Lisp Integration for Emacs (slime).

Refresh the list of avialable packages in emacs by typing

M-x package-refresh-list

and watching the toolbar to confirm it completed updating the package list.

Then install slime by typing

M-x package-install <enter> slime <enter>

and wait for the installation to finish.

Configure slime to use Steelbank Common Lisp by editing the .emacs file. Add the following line to the bottom of the file - change the path string to the location where sbcl.exe is:

(setq inferior-lisp-program "c:/somepath/sbcl/sbcl.exe")

Remember - no spaces in directory names in this path!

Initial Test.

Close and Relaunch emacs. Type M-x slime <enter>. After some initialization, spitting, and whirring, you should be presented with a REPL prompt (in a buffer named slime-repl) like this:

CL-USER>

At the prompt, type a number and hit enter. If it echoes, everyting is working.

How to Exit Debugging in slime.

Simply type a 'q' while in the debug window and you quit the debugger.

Host to Exit slime mode and shut down the IDE.

At the REPL promt in the buffer slime-repl, type a comma. This will drop you to a command prompt. Enter the command 'quit' and press enter. The IDE is now shutdown.

Till next time,

Duane