common-lisp: move helm specific stuff to post-init function

Also move defined functions to funcs.el
This commit is contained in:
syl20bnr 2016-05-26 20:09:54 -04:00
parent 5eba263448
commit dbf82d3136
2 changed files with 33 additions and 16 deletions

View file

@ -0,0 +1,25 @@
;;; funcs.el --- Slime Layer functions File for Spacemacs
;;
;; Copyright (c) 2012-2016 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;;; License: GPLv3
;; Helm integration
(defun spacemacs//slime-helm-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-helm-source))))
(and command (slime (intern command)))))

View file

@ -12,12 +12,20 @@
(setq common-lisp-packages
'(auto-highlight-symbol
common-lisp-snippets
helm
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)))
(when (configuration-layer/layer-usedp 'auto-completion)
(defun common-lisp/init-common-lisp-snippets ()))
(defun common-lisp/post-init-helm ()
(spacemacs/set-leader-keys-for-major-mode 'lisp-mode
"sI" 'spacemacs/helm-slime))
(defun common-lisp/init-slime ()
(use-package slime
:commands slime-mode
@ -41,18 +49,6 @@
(spacemacs/add-to-hooks 'slime-mode '(lisp-mode-hook)))
: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))
@ -99,7 +95,6 @@
"se" 'slime-eval-last-expression-in-repl
"si" 'slime
"sI" 'spacemacs/helm-slime
"sq" 'slime-quit-lisp
"tf" 'slime-toggle-fancy-trace)
@ -113,6 +108,3 @@
("mg" . "nav")
("mm" . "macro")
("mt" . "toggle"))))))
(when (configuration-layer/layer-usedp 'auto-completion)
(defun common-lisp/init-common-lisp-snippets ()))