| 1 | SLIME | 
|---|
| 2 | ===== | 
|---|
| 3 |  | 
|---|
| 4 |     Author:   Mark Evenson  | 
|---|
| 5 |     Created:  16-MAR-2010 | 
|---|
| 6 |     Modified: 18-MAR-2010 | 
|---|
| 7 |  | 
|---|
| 8 | SLIME is divided conceptually in two parts: the "swank" server process | 
|---|
| 9 | which runs in the native Lisp and the "slime" client process running | 
|---|
| 10 | in Emacs Lisp.  These instructions were were written to accompany | 
|---|
| 11 | ABCL, but there is nothing ABCL specific in the instructions | 
|---|
| 12 |  | 
|---|
| 13 | ## Obtaining SLIME | 
|---|
| 14 |  | 
|---|
| 15 | SLIME does not follow a release process in the standard, so you are | 
|---|
| 16 | best off with obtaining the [latest version from CVS][1]. [Daily | 
|---|
| 17 | snapshots as gzipped tarballs are also available][2].  Your local OS | 
|---|
| 18 | packaging system (i.e. MacPorts on OSX) may have a version as well. | 
|---|
| 19 |  | 
|---|
| 20 | [1]: http://common-lisp.net/project/slime/#downloading | 
|---|
| 21 | [2]: http://common-lisp.net/project/slime/snapshots/slime-current.tgz | 
|---|
| 22 |  | 
|---|
| 23 | ## Starting SLIME | 
|---|
| 24 |  | 
|---|
| 25 | One first locates the SLIME directory on the filesystem.  In the code | 
|---|
| 26 | that follows, the SLIME top level directory is assumed to be | 
|---|
| 27 | `"~/work/slime"`, so adjust this value to your local value as you see | 
|---|
| 28 | fit. | 
|---|
| 29 |  | 
|---|
| 30 | Then one configures Emacs with the proper initialization hooks by | 
|---|
| 31 | adding code something like the following to "~/.emacs": | 
|---|
| 32 |  | 
|---|
| 33 |     :::common-lisp | 
|---|
| 34 |     (add-to-list 'load-path "~/work/slime") | 
|---|
| 35 |     (setq slime-lisp-implementations  | 
|---|
| 36 |       '((abcl ("~/work/abcl/abcl")) | 
|---|
| 37 |         (abcl.svn ("~/work/abcl.svn/abcl")) | 
|---|
| 38 |         (sbcl ("/opt/local/bin/sbcl")))) | 
|---|
| 39 |     (require 'slime) | 
|---|
| 40 |     (slime-setup '(slime-fancy slime-asdf slime-banner)) | 
|---|
| 41 |  | 
|---|
| 42 | One further need to customize the setting of | 
|---|
| 43 | `SLIME-LISP-IMPLEMENTATIONS` to the location(s) of the Lisp(s) you wish to | 
|---|
| 44 | invoke via SLIME.  The value is list of lists of the form | 
|---|
| 45 |  | 
|---|
| 46 |    (SYMBOL ("/path/to/lisp")) | 
|---|
| 47 |  | 
|---|
| 48 | where SYMBOL is a mnemonic for the Lisp implementation, and the string | 
|---|
| 49 | `"/path/to/lisp"` is the absolute path of the Lisp implementation that | 
|---|
| 50 | SLIME will associate with this symbol.  In the example above, I have | 
|---|
| 51 | defined three implementations, the main abcl implementation, a version | 
|---|
| 52 | that corresponds to the latest version from SVN invoked by | 
|---|
| 53 | `"~/work/abcl.svn/abcl"`, and a version of SBCL. | 
|---|
| 54 |  | 
|---|
| 55 | To start SLIME one simply issues `M-x slime` from Emacs.  This will | 
|---|
| 56 | start the first entry in the SLIME-LISP-IMPLEMENTATIONS list.  If you | 
|---|
| 57 | wish to start a subsequent Lisp, prefix the Emacs invocation with a | 
|---|
| 58 | negative argument (i.e. `C-- M-x slime`).  This will present an | 
|---|
| 59 | interactive chooser over all symbols contained in | 
|---|
| 60 | `SLIME-LISP-IMPLEMENTATIONS`. | 
|---|
| 61 |  | 
|---|
| 62 | After you invoke SLIME, you'll see a buffer open up named | 
|---|
| 63 | `*inferior-lisp*` where the Lisp image is started up, the required swank | 
|---|
| 64 | code is complied and then loaded, finally, you'll see the "flying | 
|---|
| 65 | letters" resolving itself to a `"CL-USER>"` prompt with an inspiration | 
|---|
| 66 | message in the minibuffer.  Your initiation to SLIME has begun... | 
|---|
| 67 |  | 
|---|
| 68 |  | 
|---|
| 69 | ## Starting swank on its own | 
|---|
| 70 |  | 
|---|
| 71 | In debugging, one may wish to start the swank server by itself without | 
|---|
| 72 | connection to Emacs.  The following code will both load and start the swank server | 
|---|
| 73 | from a Lisp image.  One merely needs to change *SLIME-DIRECTORY* to | 
|---|
| 74 | point to the top directory of the server process. | 
|---|
| 75 |  | 
|---|
| 76 |     :::commmon-lisp | 
|---|
| 77 |     (defvar *slime-directory* #p"~/work/slime/") ;; Don't forget trailing slash | 
|---|
| 78 |     (load (merge-pathnames "swank-loader.lisp" *slime-directory*) :verbose t) | 
|---|
| 79 |     (swank-loader:init) | 
|---|
| 80 |     (swank:start-server "/tmp/swank.port") ;; remove if you don't want | 
|---|
| 81 |                                           ;; swank to start listening for connections. | 
|---|
| 82 |  | 
|---|
| 83 | When this code finishes executing, an integer representing the port on | 
|---|
| 84 | which the server starts will be written to `'/tmp/swank.port'` and also | 
|---|
| 85 | returned as the result of evaluating `SWANK:START-SERVER`.  One may | 
|---|
| 86 | connect to this port via issuing `M-x slime-connect` in Emacs. | 
|---|
| 87 |  | 
|---|
| 88 |  | 
|---|