spacemacs/layers/+lang/common-lisp/packages.el

119 lines
3.9 KiB
EmacsLisp
Raw Normal View History

;;; packages.el --- Common Lisp Layer packages File for Spacemacs
2015-03-07 21:58:35 +00:00
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
2015-03-07 21:58:35 +00:00
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
(setq common-lisp-packages
2016-01-21 20:56:35 +00:00
'(auto-highlight-symbol
common-lisp-snippets
slime))
(defun common-lisp/post-init-auto-highlight-symbol ()
(with-eval-after-load 'auto-highlight-symbol
(add-to-list 'ahs-plugin-bod-modes 'lisp-mode)))
2015-03-07 21:58:35 +00:00
(defun common-lisp/init-slime ()
2015-03-09 03:43:40 +00:00
(use-package slime
:commands slime-mode
:init
(progn
(spacemacs/register-repl 'slime 'slime)
(setq slime-contribs '(slime-fancy
slime-indentation
slime-sbcl-exts
slime-scratch)
2015-03-09 03:43:40 +00:00
inferior-lisp-program "sbcl")
;; enable fuzzy matching in code buffer and SLIME REPL
(setq slime-complete-symbol*-fancy t)
(setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol)
;; enabel smartparen in code buffer and SLIME REPL
2015-05-04 13:12:25 +00:00
;; (add-hook 'slime-repl-mode-hook #'smartparens-strict-mode)
(defun slime/disable-smartparens ()
(smartparens-strict-mode -1)
(turn-off-smartparens-mode))
(add-hook 'slime-repl-mode-hook #'slime/disable-smartparens)
(spacemacs/add-to-hooks 'slime-mode '(lisp-mode-hook)))
2015-03-09 03:43:40 +00:00
:config
(progn
(defun spacemacs//slime-source (&optional table)
(or table (setq table slime-lisp-implementations))
`((name . "Slime")
(candidates . ,(mapcar #'car table))
(action . (lambda (candidate)
(car (helm-marked-candidates))))))
(defun spacemacs/helm-slime ()
(interactive)
(let ((command (helm :sources (spacemacs//slime-source))))
(and command (slime (intern command)))))
(slime-setup)
(dolist (m `(,slime-mode-map ,slime-repl-mode-map))
(define-key m [(tab)] 'slime-fuzzy-complete-symbol))
;; TODO: Add bindings for the SLIME debugger?
(spacemacs/set-leader-keys-for-major-mode 'lisp-mode
"'" 'slime
"cc" 'slime-compile-file
"cC" 'slime-compile-and-load-file
"cl" 'slime-load-file
"cf" 'slime-compile-defun
"cr" 'slime-compile-region
"cn" 'slime-remove-notes
"eb" 'slime-eval-buffer
"ef" 'slime-eval-defun
"eF" 'slime-undefine-function
"ee" 'slime-eval-last-sexp
"er" 'slime-eval-region
"gg" 'slime-inspect-definition
"gb" 'slime-pop-find-definition-stack
"gn" 'slime-next-note
"gN" 'slime-previous-note
"ha" 'slime-apropos
"hA" 'slime-apropos-all
"hd" 'slime-disassemble-symbol
"hh" 'slime-describe-symbol
"hH" 'slime-hyperspec-lookup
"hp" 'slime-apropos-package
"ht" 'slime-toggle-trace-fdefinition
"hT" 'slime-untrace-all
"h<" 'slime-who-calls
"h>" 'slime-calls-who
;; TODO: Add key bindings for who binds/sets globals?
"hr" 'slime-who-references
"hm" 'slime-who-macroexpands
"hs" 'slime-who-specializes
"ma" 'slime-macroexpand-all
"mo" 'slime-macroexpand-1
"se" 'slime-eval-last-expression-in-repl
"si" 'slime
"sI" 'spacemacs/helm-slime
"sq" 'slime-quit-lisp
2016-05-16 00:49:45 +00:00
"tf" 'slime-toggle-fancy-trace)
;; prefix names for which-key
(mapc (lambda (x)
(spacemacs/declare-prefix-for-mode 'lisp-mode (car x) (cdr x)))
'(("mh" . "help")
("me" . "eval")
("ms" . "repl")
("mc" . "compile")
("mg" . "nav")
("mm" . "macro")
("mt" . "toggle"))))))
(when (configuration-layer/layer-usedp 'auto-completion)
2016-01-21 15:20:17 +00:00
(defun common-lisp/init-common-lisp-snippets ()))