Difference between revisions of "SLIME"

From WikEmacs
Jump to navigation Jump to search
(PORTACLE)
(some config from CL page)
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 that is loaded into Common Lisp.
 +
 +
== Supported implementations ==
  
 
SLIME works with the following Common Lisp implementations:
 
SLIME works with the following Common Lisp implementations:
Line 33: Line 35:
  
 
Slime is in GNU ELPA. You can install it with '''M-x package-install RET slime RET'''.
 
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"))
 +
        (cmucl ("cmucl" "-quiet"))
 +
        (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))
 +
 +
(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>
  
 
== See also ==
 
== See also ==

Revision as of 20:51, 26 December 2016

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.

Supported implementations

SLIME works with the following Common Lisp implementations:

Some implementations of other programming languages are using SLIME:

There are also clones of SLIME:

And forks:

Install with 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 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"))
        (cmucl ("cmucl" "-quiet"))
        (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))

(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)))

See also

External links