This is part of oh-my-emacs.
This file contains some settings for Common Lisp.
Package | Windows | Ubuntu/Debian/Mint | ArchLinux | Fedora | Mac OS X | Mandatory? |
---|---|---|---|---|---|---|
SBCL | sbcl | Yes | ||||
Clozure CL | [web] | No | ||||
CLISP | clisp | No |
Note:
- SBCL or Clozure CL or CLISP as a Common Lisp implementation. I recommend SBCL since it has good performance, and is easy to install via package manager.
Status | Description | |
---|---|---|
slime | Required | One of the most amazing packages for Emacs. |
ac-slime | Required | AC backend for slime. |
SLIME is the Superior Lisp Interaction Mode for Emacs, here’re some features and tips. Believe me, SLIME in Emacs is a subversive developing environment for Common Lisp, it is the ultimate solution for languages with a REPL. SLIME is the bridge between an Editor(here, Emacs for example, vim users have a slimv which is a fork of SLIME to vim) and a running Common Lisp environment. It makes your workflow so smooth and enjoyable that you will miss it so much when working with other REPL languages such as Python/Ruby/JavaScript[1], etc.
Some good resources about SLIME:
- Understanding SLIME (Using Emacs and Lisp Cooperatively), a really concise explanation of SLIME’s architecture, together with lots of valuable links, from which you will understand why SLIME is so great and amazing.
- Chapter 18. SLIME from Lisp Outside the Box provides a really detailed guide to SLIME.
- SLIME User Manual provides expert information and is your lifelong friend.
- For Chinese, Albertlee’s Blog provides a detailed overview of SLIME.
- The Newbie Guide to Getting Started on Common Lisp provides a concise and helpful guide to start programming with Common Lisp.
Besides, wiht do a really good job to list many valuable links for learning common lisp.
To use SLIME, you must install an Lisp Implementation, just like if you want to do
C programming, you must install a C compiler such as GCC. Here I recommend SBCL
for you. You can get it by sudo apt-get install sbcl
in Ubuntu/Mint/Debian.
LispWorks provides a comprehensive documentation for Common Lisp called
hyperspec, which integrates quite well with SLIME through
slime-documentation-lookup
. You can get by sudo apt-get install hyperspec
in Ubuntu/Mint/Debian. To use hyperspec in ubuntu/mint, you can: sudo apt-get
install hyperspec
, which also set proper common-lisp-hyperspec-root
for
you. On other Linux distributions, maybe you need to set it manually to tell
SLIME where to find the hyperspec document.
You can also get CLTL by sudo apt-get install cltl
, which is the defacto
standard for Common Lisp before the ANSI standard.
Oh-my-emacs also configure emacs-w3m as the default documentation browser for SLIME.
Oh-my-emacs integrates ac-slime for instant in-buffer completion, and should be
self-adapted to your system, by which I mean, it will use an available lisp
implementation by finding it using executable-find
instead of specifying a
fixed file path like /usr/bin/sbcl
.
Enough stuff, enjoy your Common Lisp journey with Emacs and SLIME.
(defun ome-slime-setup ()
;; Define multiple lisp backends
;; see http://nklein.com/2010/05/getting-started-with-clojureemacsslime/
(defmacro defslime-start (name lisp-impl)
`(when (executable-find (symbol-name ,lisp-impl))
(defun ,name ()
(interactive)
(let ((slime-default-lisp ,lisp-impl))
(slime)))))
(setq slime-lisp-implementations
`((sbcl (,(executable-find "sbcl")) :coding-system utf-8-unix)
(ccl (,(executable-find "ccl")))
(ccl64 (,(executable-find "ccl64")))
(clisp (,(executable-find "clisp")))))
(defslime-start slime-sbcl 'sbcl)
(defslime-start slime-ccl 'ccl)
(defslime-start slime-ccl64 'ccl64)
(defslime-start slime-clisp 'clisp)
;; If you use ubuntu/mint, then "sudo apt-get install hyperspec" will set
;; this for you in a file like "/etc/emacs/site-start.d/60hyperspec.el"
;; (setq common-lisp-hyperspec-root "/usr/share/doc/hyperspec/")
;; Open SBCL rc file in lisp-mode
(add-to-list 'auto-mode-alist '("\\.sbclrc$" . lisp-mode))
(global-set-key (kbd "C-c s") 'slime-selector)
(setq slime-net-coding-system 'utf-8-unix)
(setq slime-complete-symbol*-fancy t)
(setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol)
(setq inferior-lisp-program
(or (executable-find "sbcl")
(executable-find "ccl")
(executable-find "ccl64")
(executable-find "clisp")))
(slime-setup '(slime-fancy
slime-indentation
slime-banner
slime-highlight-edits)))
(defun ome-ac-slime-setup ()
(add-hook 'slime-mode-hook
(lambda ()
(set-up-slime-ac t))) ; use slime-fuzzy-complete-symbol
(add-hook 'slime-repl-mode-hook
(lambda ()
(set-up-slime-ac t)))
(eval-after-load "auto-complete"
'(add-to-list 'ac-modes 'slime-repl-mode)))
(when (or (executable-find "sbcl")
(executable-find "ccl")
(executable-find "ccl64")
(executable-find "clisp"))
(ome-install 'slime)
(ome-install 'ac-slime))
- Integrate redshank?
- Find a method to rebase the source tree of various CL implementations, which
is useful for
slime-edit-definition
.