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.

95 lines
3.4 KiB

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