Difference between revisions of "SLIME"

From WikEmacs
Jump to navigation Jump to search
(→‎Configuration: rm cmucl)
 
(One intermediate revision by the same user 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.
 +
 
 +
== 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 ==
 
== Supported implementations ==
  
SLIME works with the following Common Lisp implementations:
+
SLIME works with the following active Common Lisp implementations:
  
* [[CMU Common Lisp]] (CMUCL)
 
* [[Scieneer Common Lisp]]
 
 
* [[Steel Bank Common Lisp]] (SBCL)
 
* [[Steel Bank Common Lisp]] (SBCL)
* [[Clozure CL]] (former OpenMCL)
+
* [[Clozure CL]]  
 
* [[LispWorks]]
 
* [[LispWorks]]
 
* [[Allegro Common Lisp]]
 
* [[Allegro Common Lisp]]
Line 37: Line 51:
  
 
== Configuration ==
 
== Configuration ==
 
  
  

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:

Some implementations of other programming languages are using SLIME:

There are also clones of SLIME:

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

External links