Difference between revisions of "SLIME"
(Added a basic SLIME page) |
(→Supported implementations: rm old ones) |
||
(12 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | '''SLIME''', the '''Superior Lisp Interaction Mode for Emacs''', is an [[Emacs]] mode for developing [[Common Lisp]] applications. SLIME originates in an Emacs mode called SLIM written by Eric Marsden and developed as an open-source project by Luke Gorrie and Helmut Eller. Over 100 Lisp developers have contributed code to SLIME since the project was started in 2003. SLIME uses a backend called SWANK that is loaded into Common Lisp. | + | '''SLIME''', the '''Superior Lisp Interaction Mode for Emacs''', is an [[Emacs]] mode for developing [[Common Lisp]] applications. SLIME originates in an Emacs mode called SLIM written by Eric Marsden and developed as an open-source project by Luke Gorrie and Helmut Eller. Over 100 Lisp developers have contributed code to SLIME since the project was started in 2003. SLIME uses a backend called SWANK, offering a "language server" experience, with the added benefit that the backend is loaded into your running Common Lisp image. |
− | SLIME works with the following Common Lisp implementations: | + | == Features == |
+ | |||
+ | * it provides a REPL which is hooked to the running image, directly in Emacs, | ||
+ | * it integrates the Common Lisp debugger with an Emacs interface | ||
+ | * it provides symbol completion, | ||
+ | * code evaluation, compilation, macroexpansion | ||
+ | * cross-referencing, | ||
+ | * breaking, stepping, tracing, | ||
+ | * go to definition, | ||
+ | * online documentation, | ||
+ | * fuzzy searching functions and symbols, system names, documentation, | ||
+ | * an interactive object inspector, | ||
+ | * it supports every common Common Lisp implementation, | ||
+ | * multiple connections and multiple listener buffers (mrepl) | ||
+ | |||
+ | |||
+ | == Supported implementations == | ||
+ | |||
+ | SLIME works with the following active Common Lisp implementations: | ||
− | |||
− | |||
* [[Steel Bank Common Lisp]] (SBCL) | * [[Steel Bank Common Lisp]] (SBCL) | ||
− | * [[Clozure CL]] | + | * [[Clozure CL]] |
* [[LispWorks]] | * [[LispWorks]] | ||
* [[Allegro Common Lisp]] | * [[Allegro Common Lisp]] | ||
Line 16: | Line 32: | ||
* [[Clojure]] | * [[Clojure]] | ||
+ | * [[Swank-js]] for JavaScript | ||
There are also clones of SLIME: | There are also clones of SLIME: | ||
* [[SOLID]] for [[Objective Caml]] | * [[SOLID]] for [[Objective Caml]] | ||
+ | |||
+ | And forks: | ||
+ | |||
+ | * [https://github.com/capitaomorte/sly/blob/master/README.md#fork SLY] | ||
+ | |||
+ | == Get with Portacle, portable and multiplatform == | ||
+ | |||
+ | [https://shinmera.github.io/portacle/ Portacle] is a portable and multiplatform development environment for Common Lisp. It's the easiest way to get SBCL + Emacs + Slime + Quicklisp + Git. | ||
+ | |||
+ | == Install with package.el == | ||
+ | |||
+ | Slime is in GNU ELPA. You can install it with '''M-x package-install RET slime RET'''. | ||
+ | |||
+ | == Configuration == | ||
+ | |||
+ | |||
+ | Here's a few useful Emacs Lisp code snippets | ||
+ | for your SLIME configuration within your {{EmacsConfigFile}}: | ||
+ | |||
+ | <syntaxhighlight lang="lisp"> | ||
+ | ;; a list of alternative Common Lisp implementations that can be | ||
+ | ;; used with SLIME. Note that their presence render | ||
+ | ;; inferior-lisp-program useless. This variable holds a list of | ||
+ | ;; programs and if you invoke SLIME with any prefix argument, | ||
+ | ;; like M-- M-x slime or C-u M-x slime, you can select a program | ||
+ | ;; from that list. | ||
+ | (setq slime-lisp-implementations | ||
+ | '((ccl ("ccl")) | ||
+ | (clisp ("clisp" "-q")) | ||
+ | (sbcl ("sbcl" "--noinform") :coding-system utf-8-unix))) | ||
+ | |||
+ | ;; select the default value from slime-lisp-implementations | ||
+ | (if (eq system-type 'darwin) | ||
+ | ;; default to Clozure CL on OS X | ||
+ | (setq slime-default-lisp 'ccl) | ||
+ | ;; default to SBCL on Linux and Windows | ||
+ | (setq slime-default-lisp 'sbcl)) | ||
+ | |||
+ | ;; If you use Prelude: | ||
+ | ; (add-hook 'lisp-mode-hook (lambda () (run-hooks 'prelude-lisp-coding-hook))) | ||
+ | ; (add-hook 'slime-repl-mode-hook (lambda () (run-hooks 'prelude-interactive-lisp-coding-hook))) | ||
+ | |||
+ | ;; start slime automatically when we open a lisp file | ||
+ | (defun prelude-start-slime () | ||
+ | (unless (slime-connected-p) | ||
+ | (save-excursion (slime)))) | ||
+ | |||
+ | (add-hook 'slime-mode-hook 'prelude-start-slime) | ||
+ | |||
+ | ;; Stop SLIME's REPL from grabbing DEL, | ||
+ | ;; which is annoying when backspacing over a '(' | ||
+ | (defun prelude-override-slime-repl-bindings-with-paredit () | ||
+ | (define-key slime-repl-mode-map | ||
+ | (read-kbd-macro paredit-backward-delete-key) nil)) | ||
+ | |||
+ | (add-hook 'slime-repl-mode-hook 'prelude-override-slime-repl-bindings-with-paredit) | ||
+ | |||
+ | (eval-after-load "slime" | ||
+ | '(progn | ||
+ | (setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol | ||
+ | slime-fuzzy-completion-in-place t | ||
+ | slime-enable-evaluate-in-emacs t | ||
+ | slime-autodoc-use-multiline-p t) | ||
+ | |||
+ | (define-key slime-mode-map (kbd "TAB") 'slime-indent-and-complete-symbol) | ||
+ | (define-key slime-mode-map (kbd "C-c i") 'slime-inspect) | ||
+ | (define-key slime-mode-map (kbd "C-c C-s") 'slime-selector))) | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | === Slime history with helm === | ||
+ | |||
+ | [https://github.com/emacs-helm/helm-slime helm-slime] provides a more interactive repl history with [[Helm]]. It is not in a package repository, you have to download it and load its file (<code>M-x load-file</code>). | ||
+ | |||
+ | == See also == | ||
+ | * [[Nrepl.el]] for Clojure | ||
== External links == | == External links == | ||
* [http://common-lisp.net/project/slime/ SLIME project page] | * [http://common-lisp.net/project/slime/ SLIME project page] | ||
+ | * [https://lispcookbook.github.io/cl-cookbook/emacs-ide.html Emacs and SLIME tutorial on the Common Lisp Cookbook] | ||
* [http://osdir.com/ml/lisp.cmucl.devel/2003-08/msg00327.html The birth of SLIME on the cmucl-imp mailing list (August 2003)] | * [http://osdir.com/ml/lisp.cmucl.devel/2003-08/msg00327.html The birth of SLIME on the cmucl-imp mailing list (August 2003)] | ||
* [http://common-lisp.net/~trittweiler/talks/slime-talk-2008.pdf SLIME presentation by Tobias Rittweiler (2008)] | * [http://common-lisp.net/~trittweiler/talks/slime-talk-2008.pdf SLIME presentation by Tobias Rittweiler (2008)] | ||
Line 35: | Line 128: | ||
[[Category:Lisp]] | [[Category:Lisp]] | ||
− | [[Category: | + | [[Category:Programming]] |
+ | [[Category:Popular Package]] | ||
+ | [[Category:Third Party Package]] |
Latest revision as of 10:02, 22 February 2024
SLIME, the Superior Lisp Interaction Mode for Emacs, is an Emacs mode for developing Common Lisp applications. SLIME originates in an Emacs mode called SLIM written by Eric Marsden and developed as an open-source project by Luke Gorrie and Helmut Eller. Over 100 Lisp developers have contributed code to SLIME since the project was started in 2003. SLIME uses a backend called SWANK, offering a "language server" experience, with the added benefit that the backend is loaded into your running Common Lisp image.
Features
- it provides a REPL which is hooked to the running image, directly in Emacs,
- it integrates the Common Lisp debugger with an Emacs interface
- it provides symbol completion,
- code evaluation, compilation, macroexpansion
- cross-referencing,
- breaking, stepping, tracing,
- go to definition,
- online documentation,
- fuzzy searching functions and symbols, system names, documentation,
- an interactive object inspector,
- it supports every common Common Lisp implementation,
- multiple connections and multiple listener buffers (mrepl)
Supported implementations
SLIME works with the following active Common Lisp implementations:
- Steel Bank Common Lisp (SBCL)
- Clozure CL
- LispWorks
- Allegro Common Lisp
- CLISP
- Embeddable Common Lisp (ECL)
- Armed Bear Common Lisp (ABCL)
Some implementations of other programming languages are using SLIME:
There are also clones of SLIME:
- SOLID for Objective Caml
And forks:
Get with Portacle, portable and multiplatform
Portacle is a portable and multiplatform development environment for Common Lisp. It's the easiest way to get SBCL + Emacs + Slime + Quicklisp + Git.
Install with package.el
Slime is in GNU ELPA. You can install it with M-x package-install RET slime RET.
Configuration
Here's a few useful Emacs Lisp code snippets for your SLIME configuration within your Emacs configuration file:
;; a list of alternative Common Lisp implementations that can be
;; used with SLIME. Note that their presence render
;; inferior-lisp-program useless. This variable holds a list of
;; programs and if you invoke SLIME with any prefix argument,
;; like M-- M-x slime or C-u M-x slime, you can select a program
;; from that list.
(setq slime-lisp-implementations
'((ccl ("ccl"))
(clisp ("clisp" "-q"))
(sbcl ("sbcl" "--noinform") :coding-system utf-8-unix)))
;; select the default value from slime-lisp-implementations
(if (eq system-type 'darwin)
;; default to Clozure CL on OS X
(setq slime-default-lisp 'ccl)
;; default to SBCL on Linux and Windows
(setq slime-default-lisp 'sbcl))
;; If you use Prelude:
; (add-hook 'lisp-mode-hook (lambda () (run-hooks 'prelude-lisp-coding-hook)))
; (add-hook 'slime-repl-mode-hook (lambda () (run-hooks 'prelude-interactive-lisp-coding-hook)))
;; start slime automatically when we open a lisp file
(defun prelude-start-slime ()
(unless (slime-connected-p)
(save-excursion (slime))))
(add-hook 'slime-mode-hook 'prelude-start-slime)
;; Stop SLIME's REPL from grabbing DEL,
;; which is annoying when backspacing over a '('
(defun prelude-override-slime-repl-bindings-with-paredit ()
(define-key slime-repl-mode-map
(read-kbd-macro paredit-backward-delete-key) nil))
(add-hook 'slime-repl-mode-hook 'prelude-override-slime-repl-bindings-with-paredit)
(eval-after-load "slime"
'(progn
(setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol
slime-fuzzy-completion-in-place t
slime-enable-evaluate-in-emacs t
slime-autodoc-use-multiline-p t)
(define-key slime-mode-map (kbd "TAB") 'slime-indent-and-complete-symbol)
(define-key slime-mode-map (kbd "C-c i") 'slime-inspect)
(define-key slime-mode-map (kbd "C-c C-s") 'slime-selector)))
Slime history with helm
helm-slime provides a more interactive repl history with Helm. It is not in a package repository, you have to download it and load its file (M-x load-file
).
See also
- Nrepl.el for Clojure
External links
- SLIME project page
- Emacs and SLIME tutorial on the Common Lisp Cookbook
- The birth of SLIME on the cmucl-imp mailing list (August 2003)
- SLIME presentation by Tobias Rittweiler (2008)
- Review of SLIME by Andy Wingo
- Bill Clementson's "Slime Tips and Techniques" - Part 1 (See also Part 2, Part 3, Part 4, Part 5, Part 6, and Part 7)
- Bill Clementson's "SLIME Refactoring" describes how to set up SLIME
- Bill Clementson's "Emacs Keymaps and the SLIME scratch buffer
- Bill Clementson's "CL, Music and SLIME Tutorials" contains a good SLIME tutorial
- Marco Baringer's (SLIME guru) SLIME setup
- Marco Baringer's "Editing Lisp Code with Emacs"
- The slime-devel Archives