emacs-prelude/modules/prelude-common-lisp.el

98 lines
3.5 KiB
EmacsLisp
Raw Normal View History

2011-10-08 23:05:06 +03:00
;;; prelude-common-lisp.el --- Emacs Prelude: lisp-mode and SLIME config.
;;
;; Copyright (c) 2011 Bozhidar Batsov
;;
;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/Prelude
;; Version: 1.0.0
;; Keywords: convenience
;; This file is not part of GNU Emacs.
;;; Commentary:
;; Configuration for lisp-mode and SLIME.
;;; License:
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 3
;; of the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.
;;; Code:
(require 'prelude-lisp)
2011-10-15 13:04:02 +03:00
;; the SBCL configuration file is in Common Lisp
2011-10-08 23:05:06 +03:00
(add-to-list 'auto-mode-alist '("\\.sbclrc$" . lisp-mode))
;; Use SLIME from Quicklisp
(defun prelude-load-common-lisp-slime ()
(interactive)
;; Common Lisp support depends on SLIME being installed with Quicklisp
(if (file-exists-p (expand-file-name "~/quicklisp/slime-helper.el"))
(load (expand-file-name "~/quicklisp/slime-helper.el"))
2011-10-15 13:04:02 +03:00
(message "%s" "SLIME is not installed. Use Quicklisp to install it.")))
2011-10-08 23:05:06 +03:00
;; 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 a negative prefix
;; argument, M-- 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
2011-10-20 00:54:17 +03:00
(if (eq system-type 'darwin)
2011-10-15 13:04:02 +03:00
;; default to Clozure CL on OS X
(setq slime-default-lisp 'ccl)
;; default to SBCL on Linux and Windows
(setq slime-default-lisp 'sbcl))
2011-10-08 23:05:06 +03:00
(add-hook 'lisp-mode-hook 'prelude-lisp-coding-hook)
(add-hook 'slime-repl-mode-hook 'prelude-interactive-lisp-coding-hook)
2011-10-08 23:05:06 +03:00
;; 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)
2011-10-08 23:05:06 +03:00
;; 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)))
(provide 'prelude-common-lisp)
;;; prelude-common-lisp.el ends here