I run Debian GNU/Linux most of the time, so the instructions here will most likely be 100% correct if you run Debian, Ubuntu, or any other Linux distributions that use .deb package files. If you run any other distributions, you will still benefit from reading this article, but some instructions may vary.

0. Downloading what you need

The applications you need are, obviously enough, Emacs, SLIME, and the Common Lisp implementation of your choice. I will be using SBCL. You don't really need cl-asdf if you re just starting out, and it might not be in the repositories for your distribution. Please note that due to the license in one file, SLIME is in the non-free section of the Debian repositories.


1. Setting up the Common Lisp environment

When everything has been correctly installed, fire up Emacs. I don 't know whether you like the defaults or not, but I find certain things annoying (including the colors), so create a text file named .emacs in your /home/$USER directory. You will need to create one anyway, as we still need to set Emacs up so we can use SLIME and SBCL.

This is what needs to go in your .emacs file:

;; Set up the Common Lisp environment
(add-to-list 'load-path "/usr/share/common-lisp/source/slime/")
(setq inferior-lisp-program "/usr/bin/sbcl")
(require 'slime)

You may need to modify the path to SLIME and SBCL, but that should be good enough if you installed it through aptitude.

2. Adding functionality to Emacs

We 're not done yet, but here 's what you will need to add to your .emacs file if you want to use my settings. If you don 't know what something does, read the comment (anything after ;; is a comment). Feel free to include and/or modify anything you like.

;; Text and the such
;; Use colors to highlight commands, etc.
(global-font-lock-mode t)
;; Disable the welcome message
(setq inhibit-startup-message t)
;; Format the title-bar to always include the buffer name
(setq frame-title-format "emacs – %b")
;; Display time
;; Make the mouse wheel scroll Emacs
(mouse-wheel-mode t)
;; Always end a file with a newline
(setq require-final-newline t)
;; Stop emacs from arbitrarily adding lines to the end of a file when the
;; cursor is moved past the end of it:
(setq next-line-add-newlines nil)
;; Flash instead of that annoying bell
(setq visible-bell t)
;; Remove icons toolbar
(if (> emacs-major-version 20)
(tool-bar-mode -1))
;; Use y or n instead of yes or not
(fset 'yes-or-no-p 'y-or-n-p)

3. Making Emacs look prettier

These are my color settings, if you would like to include them. There are separate color settings for the X11 version of Emacs and for the console one.

(defun faces_x ()
;; these are used when in X
'(default ((t (:foreground "wheat" :background "black"))))
'(flyspell-duplicate ((t (:foreground "Gold3" :underline t :weight normal))))
'(flyspell-incorrect ((t (:foreground "OrangeRed" :underline t :weight normal))))
'(font-lock-comment-face ((t (:foreground "SteelBlue1"))))
'(font-lock-function-name-face ((t (:foreground "gold"))))
'(font-lock-keyword-face ((t (:foreground "springgreen"))))
'(font-lock-type-face ((t (:foreground "PaleGreen"))))
'(font-lock-variable-name-face ((t (:foreground "Coral"))))
'(menu ((((type x-toolkit)) (:background "light slate gray" :foreground "wheat" :box (:line-width 2 :color "grey75" :style released-button)))))
'(mode-line ((t (:foreground "black" :background "light slate gray"))))
'(tool-bar ((((type x w32 mac) (class color)) (:background "midnight blue" :foreground "wheat" :box (:line-width 1 :style released-button))))))
(set-cursor-color "deep sky blue")
(set-foreground-color "wheat")
(set-background-color "black")
(set-face-foreground 'default "wheat")
(set-face-background 'default "black"))
(defun faces_nox ()
;; these are used when in terminal
'(default ((t (:foreground "white" :background "black"))))
'(font-lock-comment-face ((t (:foreground "magenta"))))
'(font-lock-function-name-face ((t (:foreground "red"))))
'(font-lock-keyword-face ((t (:foreground "green"))))
'(font-lock-type-face ((t (:foreground "blue"))))
'(font-lock-string-face ((t (:foreground "cyan"))))
'(font-lock-variable-name-face ((t (:foreground "blue"))))
'(menu ((((type x-toolkit)) (:background "white" :foreground "black" :box (:line-width 2 :color "grey75" :style released-button)))))
'(modeline ((t (:foreground "blue" :background "white")))))
(set-cursor-color "blue")
(set-foreground-color "white")
(set-background-color "black")
(set-face-foreground 'default "white")
(set-face-background 'default "black"))
(if window-system

4. Running SLIME

Right. Now, fire up emacs.


Although I assume you have a little experience with Emacs (or, at least, some fine googling skills), I will tell you how to start SLIME. Just press M-x (that means “Press the (usually) Alt key and then press x”) and write slime. It should look like this:


Press RET (that 's your Return or Enter key). You should see a trippy text effect, and then this:


Now you're done. Happy hacking, and forgive me if my explanations have not been clear enough.