How I Installed CLISP 2.49 On My Windows 7 PC
Curtis Flippin
April 14, 2015

Introduction

My objective was to install the latest version of CLISP, currently 2.49, the Emacs editor, and Quicklisp/Slime on my Windows 7 PC with everything configured to work together as they should. It took four days to figure out how to do this and I could not find any accurate, useful information about how to accomplish this task on the Internet.

I had a specific project in mind and I wanted to use LISP to develop a solution. The kind folks at Allegro allowed me the use of their excellent LISP IDE for a full year and I am sincerely grateful. I am an Engineer and my area of interest is domain or discipline specific grammars so I needed to have Common Lisp to continue my work in this area.

I am detailing my experience in the hope that this information will be of some aid to anyone who wants to create a CLISP/Slime IDE on a PC running the Windows 7 OS. Do not use these examples and instructions if you have an operating system other than Windows 7, such as Windows XP. They do not apply to any other flavor of Windows OS.

Baseline Parameters

I’ll begin to set the stage by stating that the way Windows 7 sets up environment variables that are used to determine the $HOME directory causes problems with CLISP, Emacs, and QuickLisp. They just don’t seem to agree on where the $HOME directory is located. But this problem is easily remedied and I strongly advise that you DO NOT CHANGE ANY OF YOUR ENVIRONMENT VARIABLES!! By the way, the Windows 7 facility for viewing and editing environment variables is absolutely miserable. I used the Windows Accessory Command Prompt to determine my $HOME directory and to ensure that CLISP added its directory to the %path% environment variable. More about this a bit later.

Here is the application baseline:

You may have read that CLISP 2.49 has problems with Windows paths and wont load Slime properly. Both statements are true but, I will describe how to overcome both problems quite easily. Keep in mind that I am describing a system that is up and running on my Windows 7 PC. By the way, QuickLisp loads and starts the Slime IDE from Emacs. Slime requires CLISP version 2.49 (i.e. the latest version). If you find advice to the contrary on the Internet, it may be out of date (i.e. before 2014).

Where to find the applications:

I found that the installation is much easier when the three main components of this system are installed in this order:

(1)
CLISP 2.49
(2)
Emacs 24.3
(3)
QuickLisp Beta
(4)
Slime 2.12

Before installing any software I created a restore point just in case I need to back out of everything and start over from the beginning. Something I did have to do before I arrived at the secret formula for success! You can create a restore point from the System Protection tab of System Properties.

Install CLISP

I have a folder in my $HOME directory called Launch Pad that I use to install new software and I ran the CLISP installer from there. I chose to install for a single user (myself) to avoid any new problems a public installation might cause. This is a 32 bit Windows application and it will be located in ”C:/Program Files (x86)/clisp-2.49”. The installer will append this directory to the %PATH% environment variable. I verified that the directory had been added by opening a Command Prompt and typing:

echo %path%

then found the ”clisp-2.49” directory at the end of the string.

While in the command prompt confirm the $HOME directory by entering:

echo %USERPROFILE%

The command prompt normally defaults to this directory when it opens but its important to be certain. Mine is ”C:/Users/Curtis”, for instance.

The installer ran without detectable error. I used the CLISP link in the start menu to run it and got the welcome text with no error messages. To quit CLISP type

(quit)

at the ”[1]>” prompt and hit Enter. CLISP is installed but not yet properly configured. Configuration will be done when all of the packages have been installed.

Install Emacs

The Emacs prebuilt binary for Windows is a zip file located at
”http://ftp.gnu.org/gnu/emacs/windows” and the file is named ”emacs-24.3-bin-i386.zip”. Emacs does not include an installer, so I had to do it the old fashioned way.

Emacs should be extracted into directory ”C:/Program Files (x86)/emacs-24.3”. If you can unzip the emacs zip file in ”C:/Program Files (x86)”, it will create the ”emacs-24.3” folder for you. You may, however, encounter a security issue that prevents you from unzipping the files. If that is the case, unzip the files in an empty directory, like Launch Pad. Then, copy the entire emacs-24.3 directory with all the included files to ”C:/Program Files (x86)”. If administrator permission is required, you will be asked to confirm the copy operation before it can complete.

Once Emacs is in place, open the ”...emacs-24.3/bin” directory, locate file runemacs.exe, and place a shortcut to runemacs on the Desktop. Run the shortcut to Emacs now to make sure it loads ok. Emacs configuration will be carried out after QuickLisp is installed.

Install QuickLisp

QuickLisp is an install file written in LISP. It can be found at
”http://www.quicklisp.org/beta/”. Create a folder in your $HOME directory named ”quicklisp”, ”C:/Users/Curtis/quicklisp”, for example. Download the file quicklisp.lisp and place it in the quicklisp folder that was just created.

Now run CLISP and at the prompt type a LISP load command that specifies the folder containing your quicklisp.lisp installer. In my case, for example:

(load "C:/Users/Curtis/quicklisp/quicklisp.lisp")

After it loads, type the following command exactly as shown:

(quicklisp-quickstart:install :path "C:\\quicklisp\\")

Before leaving CLISP, type the following command and make note of the result:

(user-homedir-pathname)

It should say something like

C:\\Users\\Curtis\\

but with your identity in place of mine. This is what CLISP believes to be the $HOME directory when it is run from a Command Prompt window. It is, in fact, the Windows 7 $HOME directory specified in the environment variable %USERPROFILE%. When CLISP is run from within Emacs, however, CLISP will believe the $HOME directory is what Emacs believes it to be. Which is:

c:/Users/Curtis/AppData/Roaming

A situation which serves to prevent CLISP, Emacs, QuickLisp and Slime from working together. That is why all the software must be placed where I placed it and the following configuration instructions must be followed to the letter.

Configuration

I took great care to install all the software exactly where it needs to be. But that’s not good enough to create a configuration that results in a smooth working Common LISP Independent Development Environment. There are a few remaining kinks that need to be addressed.

The CLISP Run Control File

When CLISP is started, it looks for a Run Control File named

.clisprc.lisp

in the directory that is given by

user-homedir-pathname

which is going to be something like

C:\\Users\\Usersname\\

or, in my case,

C:\\Users\\Curtis\\

The Run Control File is not part of the CLISP distribution but this is not a problem because it is just a LISP source file that can be created with a text editor. Just create a text file with a brief header that can be something like this:

;;; CLISP Run Control File  
;;; John Peters 2015-04-April  
;;;  
;;; This file should reside in the CLISP User Home Directory  
;;; (user-homedir-pathname) ; in CLISP will print ’homedir’

and save it in the proper directory.

CLISP has some difficulty finding temporary directories which, in turn, affects Slime. This can be fixed by reopening the CLISP Run Control file and adding the following LISP code:

;;; In Windows 7, CLISP has trouble finding the temporary directories.  
;;; This is a fix for this problem in Windows.  
(setf temporary-file-directory "C:\\Users\\Curtis\\AppData\\Local\\Temp")  
(setf (ext:getenv "temp") temporary-file-directory)  
(setf (ext:getenv "tmp") temporary-file-directory)

Before closing the file, add the following code to Load QuickLisp when CLISP is launched and mind the indentation, two spaces per indent:

;;; The following lines added by ql:add-to-init-file:  
#-quicklisp  
(let ((quicklisp-init (merge-pathnames "quicklisp\\setup.lisp" (user-homedir-pathname))))  
  (when (probe-file quicklisp-init)  
    (load quicklisp-init)))  
 
;;; End File .clisprc.lisp

Now save and close the file. That is all that’s required for CLISP run control.

Install Slime

Run CLISP and at the prompt type the following line and hit Enter:

(ql:quickload "quicklisp-slime-helper")

That will install the Slime Common LISP IDE.

Emacs Configuration

When Emacs starts, it will look for directory .emacs.d in its version of the $HOME directory. In my case this is:

c:\Users\Curtis\AppData\Roaming\.emacs.d

There it will look for a configuration file named:

init.el

which is an Emacs Lisp source file containing Emacs configuration instructions. The directory may or may not already exist. It it doesn’t make the directory and the init.el file or just create the file if the directory is already in place. The file can be created with a text editor. this is a trimmed down version of mine:

;;; init.el --- Emacs editor initialization file  
 
;; Author: Curtis G Flippin <cgf@lighthousepubl.com>  
;; Created: 30 July 2013  
;; Modified: 1 April 2015  
;; Keywords: forth, gforth, emacs, CLISP  
 
;; This File Must Be Placed Into Directory  
;; C:\Users\Curtis\AppData\Roaming\.emacs.d  
;; In Windows 7 OS in Order For Emacs To  
;; Find It On Startup  
 
;; Designed for Emacs 24.3.1 Win32  
 
;;; Programming Language Packages Loaded  
;;; At Startup  
 
;; Load Slime IDE Helper, CLISP/Emacs marriage  
 
(load "C:\\Users\\Curtis\\quicklisp\\slime-helper.el")  
(setq inferior-lisp-program "clisp.exe")  
 
;;; init.el ends here

The entire file shown above consists of comments except for two lines of code following the comment ”Load Slime IDE Helper, CLISP/Emacs marriage”. They are both required. The first tells Emacs to load Slime using the helper file. The second, will cause clisp.exe to be loaded as an inferior Lisp program.

The Smoke Test

If you’ve completed the preparation, we should be good to go. Run Emacs. Type Meta-x (that’s Emacs Speak for Alt-x) which you will see echoed at the bottom of the page. Then type ”slime” and hit Enter. After a brief load and setup sequence, you should be at a CL-USER prompt within a *slime-repl clisp* buffer inside Emacs.

Click on the Buffers tab and select list all buffers to see a list of active buffers. One of them is the inferior-lisp buffer. Click on that and now you are inside CLISP just as though you were running it from the command prompt. Scroll the page up to the top and you’ll see the familiar start-up banner.

Click at the CL-User> prompt to go back to that buffer and type a comma. That will take you to the bottom of the page again where it will wait for your Command. Just type quit to cleanly exit CLISP. From the Emacs File tab menu select quit to exit Emacs.

Congratulations! Now, get to work!

BACK