| Previous Section | Next Section | Table of Contents | Glossary | Index |
A very common way to use Clozure CL is to run it within the GNU Emacs editor, using a Lisp interface called SLIME ("Superior Lisp Interaction Mode for Emacs"). SLIME is an Emacs package designed to provide good support within Emacs for any of several Common Lisp implementations; one of the supported implementations is Clozure CL. This page describes how you can download SLIME and set it up to work with your Clozure CL installation.
Why use SLIME? With SLIME, you can do the following things from within an Emacs editing session:
run and control Lisp
evaluate, compile, and load files or expressions
macroexpand expressions
fetch documentation and source code for Lisp symbols
autocomplete symbols and package names
cross-reference function calls
examine stack traces and debug errors
For complete information about SLIME, see the SLIME home page. The SLIME home page provides up-to-date downloads, plus documentation, tutorials, and instructional screencasts.
In order to simplify these instructions, we'll make several assumptions about your system. Specifically, we assume:
You have a working installation of GNU Emacs. If you don't have a working copy of GNU Emacs, see the web page on obtaining Emacs. If you prefer to use XEmacs instead of GNU Emacs, these instructions should still work; SLIME supports XEmacs Version21. Mac OS X includes an Emacs installation. If you want to look into different versions, you can check out theEmacsWiki, which maintains a page, EmacsForMacOS, that provides much more information about using Emacs on the Mac.
A popular version of Emacs among Mac users is Aquamacs. This application is a version of GNU Emacs with a number of customizations meant to make it behave more like a standard Macintosh application, with windows, a menubar, etc. Aquamacs includes SLIME; if you like Aquamacs then you can use SLIME right away, without getting and installing it separately. You just need to tell SLIME where to find your installation of Clozure CL.
You have a working copy of Clozure CL, installed in
"~/ccl"If you prefer to install
Clozure CL in some directory other
than"~/ccl" then these
instructions still work, but you must remember to use your
path to your ccl directory instead of the one that we give
here.
You install emacs add-ons in the folder
"~/emacs/site/"If this directory
doesn't exist on your system, you can just create it.If
you prefer to install Emacs add-ons in some place other
than"~/emacs/site/" then you must
remember to use your path to Emacs add-ons in place of
ours.
You can get SLIME from the SLIME Home Page. Stable releases and CVS snapshots are available as archive files, or you can follow the instructions on the SLIME Home Page to check out the latest version from their CVS repository.
It's worth noting that stable SLIME releases happen very seldom, but the SLIME developers often make changes and improvements that are available through CVS updates. If you asked the SLIM developers, they would most likely recommend that you get SLIME from their CVS repository and update it frequently.
Whether you get it from CVS, or download and unpack one of the available archives, you should end up with a folder named "slime" that contains the SLIME distribution.
Once you have the "slime" folder described in the previous section, installation is a simple matter of copying the folder to the proper place. You can drag it into the "~/emacs/site/" folder, or you can use a terminal command to copy it there. For example, assuming your working directory contains the unpacked "slime" folder:
$ cp -R
slime ~/emacs/site/
That's all it takes.
Once SLIME and Clozure CL are installed, you just need to add a line to your "~/.emacs" file that tells SLIME where to find the script that runs Clozure CL:
(setq inferior-lisp-program "~/ccl/scripts/ccl64")
or
(setq inferior-lisp-program "~/ccl/scripts/ccl")
Aquamacs users should add this line to the file "~/Library/Preferences/Aquamacs Emacs/Preferences.el".
Once the preparations in the previous section are complete, exit Emacs and restart it, to ensure that it reads the changes you made in your ".emacs" file (alternatively, you could tell Emacs to reload the ".emacs" file). If all went well, you should now be ready to run Clozure CL using SLIME.
To run Clozure CL, execute the command "M-x slime". SLIME should start an Clozure CL session in a new buffer. (If you are unfamiliar with the Emacs notation "M-x command", see the GNU Emacs FAQ; specifically, take a look at questions 1, 2, and 128.)
Sometimes you'll get a new version of Clozure CL, set up Emacs to use it with SLIME, and SLIME will fail. Most likely what has happened is that the new version of Clozure CL has a change in the output files produced by the compiler (Clozure CL developers will say "the fasl version has changed." fasl stands for "fast load" aka compiled files). This problem is easy to fix: just delete the existing SLIME fasl files. The next time you launch Emacs and start SLIME, it will automatically recompile the Lisp files, and that should fix the problem.
SLIME's load process stores its fasl files in a hidden folder inside your home folder. The path is
~/.slime/fasl
You can use a shell command to remove the fasl files, or remove them using your system's file browser.
Note for Macintosh Users: The leading "." character in the ".slime" folder's name prevents the Finder from showing this folder to you. If you use the "Go To Folder" menu item in the Finder's "Go" menu, you can type in "~/.slime" and the Finder will show it to you. You can then drag the "fasl" folder to the trash.
SLIME has not been updated to account for recent changes made in Clozure CL to support x86-64 processors. You may run into bugs running on those platforms.
The SLIME backtrace sometimes shows incorrect information.
return-from-frame and
apply-in-frame do not work reliably. (If
they work at all, it's pure luck.)
Some versions of Emacs on the Macintosh may have trouble finding the shell script that runs Clozure CL unless you specify a full path to it. See the above section "Telling Emacs About SLIME" to learn how to specify the path to the shell script.
For more help with Clozure CL on Mac OS X, consult the Clozure CL mailing lists. You can find information about the mailing lists on the Clozure CL wiki.
| Previous Section | Next Section | Table of Contents | Glossary | Index |