Emacs config utilizing prelude as a base
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
3.5 KiB

  1. ;;; prelude-common-lisp.el --- Emacs Prelude: lisp-mode and SLIME config.
  2. ;;
  3. ;; Copyright (c) 2011 Bozhidar Batsov
  4. ;;
  5. ;; Author: Bozhidar Batsov <bozhidar.batsov@gmail.com>
  6. ;; URL: http://www.emacswiki.org/cgi-bin/wiki/Prelude
  7. ;; Version: 1.0.0
  8. ;; Keywords: convenience
  9. ;; This file is not part of GNU Emacs.
  10. ;;; Commentary:
  11. ;; Configuration for lisp-mode and SLIME.
  12. ;;; License:
  13. ;; This program is free software; you can redistribute it and/or
  14. ;; modify it under the terms of the GNU General Public License
  15. ;; as published by the Free Software Foundation; either version 3
  16. ;; of the License, or (at your option) any later version.
  17. ;;
  18. ;; This program is distributed in the hope that it will be useful,
  19. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. ;; GNU General Public License for more details.
  22. ;;
  23. ;; You should have received a copy of the GNU General Public License
  24. ;; along with GNU Emacs; see the file COPYING. If not, write to the
  25. ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  26. ;; Boston, MA 02110-1301, USA.
  27. ;;; Code:
  28. (require 'prelude-lisp)
  29. ;; the SBCL configuration file is in Common Lisp
  30. (add-to-list 'auto-mode-alist '("\\.sbclrc$" . lisp-mode))
  31. ;; Use SLIME from Quicklisp
  32. (defun prelude-load-common-lisp-slime ()
  33. (interactive)
  34. ;; Common Lisp support depends on SLIME being installed with Quicklisp
  35. (if (file-exists-p (expand-file-name "~/quicklisp/slime-helper.el"))
  36. (load (expand-file-name "~/quicklisp/slime-helper.el"))
  37. (message "%s" "SLIME is not installed. Use Quicklisp to install it.")))
  38. ;; a list of alternative Common Lisp implementations that can be
  39. ;; used with SLIME. Note that their presence render
  40. ;; inferior-lisp-program useless. This variable holds a list of
  41. ;; programs and if you invoke SLIME with a negative prefix
  42. ;; argument, M-- M-x slime, you can select a program from that list.
  43. (setq slime-lisp-implementations
  44. '((ccl ("ccl"))
  45. (clisp ("clisp" "-q"))
  46. (cmucl ("cmucl" "-quiet"))
  47. (sbcl ("sbcl" "--noinform") :coding-system utf-8-unix)))
  48. ;; select the default value from slime-lisp-implementations
  49. (if (eq system-type 'darwin)
  50. ;; default to Clozure CL on OS X
  51. (setq slime-default-lisp 'ccl)
  52. ;; default to SBCL on Linux and Windows
  53. (setq slime-default-lisp 'sbcl))
  54. (add-hook 'lisp-mode-hook 'prelude-lisp-coding-hook)
  55. (add-hook 'slime-repl-mode-hook 'prelude-interactive-lisp-coding-hook)
  56. ;; start slime automatically when we open a lisp file
  57. (defun prelude-start-slime ()
  58. (unless (slime-connected-p)
  59. (save-excursion (slime))))
  60. (add-hook 'slime-mode-hook 'prelude-start-slime)
  61. ;; Stop SLIME's REPL from grabbing DEL,
  62. ;; which is annoying when backspacing over a '('
  63. (defun prelude-override-slime-repl-bindings-with-paredit ()
  64. (define-key slime-repl-mode-map
  65. (read-kbd-macro paredit-backward-delete-key) nil))
  66. (add-hook 'slime-repl-mode-hook 'prelude-override-slime-repl-bindings-with-paredit)
  67. (eval-after-load "slime"
  68. '(progn
  69. (setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol
  70. slime-fuzzy-completion-in-place t
  71. slime-enable-evaluate-in-emacs t
  72. slime-autodoc-use-multiline-p t)
  73. (define-key slime-mode-map (kbd "TAB") 'slime-indent-and-complete-symbol)
  74. (define-key slime-mode-map (kbd "C-c i") 'slime-inspect)
  75. (define-key slime-mode-map (kbd "C-c C-s") 'slime-selector)))
  76. (provide 'prelude-common-lisp)
  77. ;;; prelude-common-lisp.el ends here