2015-05-07 04:31:13 +00:00
|
|
|
;;; packages.el --- Emacs Lisp Layer packages File for Spacemacs
|
|
|
|
;;
|
2018-01-04 07:00:25 +00:00
|
|
|
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
|
2015-05-07 04:31:13 +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 emacs-lisp-packages
|
2015-05-09 23:23:49 +00:00
|
|
|
'(
|
2015-10-15 12:18:53 +00:00
|
|
|
auto-compile
|
2015-08-07 09:08:32 +00:00
|
|
|
company
|
2017-02-11 21:31:56 +00:00
|
|
|
(debug :location built-in)
|
|
|
|
(edebug :location built-in)
|
2015-05-09 23:23:49 +00:00
|
|
|
eldoc
|
|
|
|
elisp-slime-nav
|
2015-09-24 02:02:39 +00:00
|
|
|
(emacs-lisp :location built-in)
|
2015-05-09 23:23:49 +00:00
|
|
|
evil
|
2018-01-04 06:34:23 +00:00
|
|
|
evil-cleverparens
|
2018-06-11 03:24:44 +00:00
|
|
|
eval-sexp-fu
|
2015-08-14 02:40:29 +00:00
|
|
|
flycheck
|
2019-04-10 03:45:05 +00:00
|
|
|
flycheck-package
|
2016-04-05 04:08:34 +00:00
|
|
|
ggtags
|
2017-08-26 21:18:09 +00:00
|
|
|
counsel-gtags
|
2016-04-05 04:08:34 +00:00
|
|
|
helm-gtags
|
2016-01-22 15:23:43 +00:00
|
|
|
(ielm :location built-in)
|
2015-05-09 23:23:49 +00:00
|
|
|
macrostep
|
2017-10-03 20:06:37 +00:00
|
|
|
nameless
|
2017-09-24 15:23:50 +00:00
|
|
|
overseer
|
2017-05-29 09:35:22 +00:00
|
|
|
parinfer
|
2015-05-09 23:23:49 +00:00
|
|
|
semantic
|
|
|
|
smartparens
|
2018-11-20 19:55:37 +00:00
|
|
|
srefactor
|
|
|
|
))
|
2015-05-07 04:31:13 +00:00
|
|
|
|
2016-01-22 15:23:43 +00:00
|
|
|
(defun emacs-lisp/init-ielm ()
|
|
|
|
(use-package ielm
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2016-01-22 15:23:43 +00:00
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(spacemacs/register-repl 'ielm 'ielm)
|
|
|
|
(dolist (mode '(emacs-lisp-mode lisp-interaction-mode))
|
|
|
|
(spacemacs/declare-prefix-for-mode mode "ms" "ielm")
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode
|
2016-01-26 16:31:15 +00:00
|
|
|
"'" 'ielm
|
2016-01-22 15:23:43 +00:00
|
|
|
"si" 'ielm)))
|
|
|
|
:config
|
2015-08-07 09:08:32 +00:00
|
|
|
(defun ielm-indent-line ()
|
|
|
|
(interactive)
|
|
|
|
(let ((current-point (point)))
|
|
|
|
(save-restriction
|
|
|
|
(narrow-to-region (search-backward-regexp "^ELISP>") (goto-char current-point))
|
2016-01-22 15:23:43 +00:00
|
|
|
(lisp-indent-line))))))
|
2015-08-07 09:08:32 +00:00
|
|
|
|
|
|
|
(defun emacs-lisp/post-init-company ()
|
2017-01-02 05:39:04 +00:00
|
|
|
(spacemacs|add-company-backends :backends company-capf
|
|
|
|
:modes emacs-lisp-mode)
|
|
|
|
(spacemacs|add-company-backends :backends (company-files company-capf)
|
|
|
|
:modes ielm-mode))
|
2015-06-14 13:55:24 +00:00
|
|
|
|
2017-02-11 21:31:56 +00:00
|
|
|
(defun emacs-lisp/init-debug ()
|
|
|
|
(use-package debug
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2017-02-11 21:31:56 +00:00
|
|
|
:init (dolist (mode '(emacs-lisp-mode lisp-interaction-mode))
|
|
|
|
(spacemacs/declare-prefix-for-mode mode "md" "debug")
|
2017-05-09 14:53:08 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode
|
2017-02-11 21:31:56 +00:00
|
|
|
"dt" 'spacemacs/elisp-toggle-debug-expr-and-eval-func))
|
|
|
|
:config (evilified-state-evilify-map debugger-mode-map
|
|
|
|
:mode debugger-mode)))
|
|
|
|
|
|
|
|
(defun emacs-lisp/init-edebug ()
|
|
|
|
(use-package edebug
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2017-02-11 21:31:56 +00:00
|
|
|
:init
|
|
|
|
(progn
|
2017-02-12 17:50:07 +00:00
|
|
|
;; key bindings
|
2017-02-11 21:31:56 +00:00
|
|
|
(dolist (mode '(emacs-lisp-mode lisp-interaction-mode))
|
2017-05-09 14:53:08 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode
|
2017-02-11 21:31:56 +00:00
|
|
|
"df" 'spacemacs/edebug-instrument-defun-on
|
|
|
|
"dF" 'spacemacs/edebug-instrument-defun-off))
|
2017-02-12 17:50:07 +00:00
|
|
|
;; since we evilify `edebug-mode-map' we don't need to intercept it to
|
|
|
|
;; make it work with evil
|
2019-04-12 18:31:37 +00:00
|
|
|
(evil-set-custom-state-maps
|
|
|
|
'evil-intercept-maps
|
|
|
|
'evil-pending-intercept-maps
|
|
|
|
'intercept-state
|
|
|
|
'evil-make-intercept-map
|
|
|
|
(delq (assq 'edebug-mode-map evil-intercept-maps)
|
|
|
|
evil-intercept-maps))
|
2017-05-14 16:46:31 +00:00
|
|
|
(evilified-state-evilify-map edebug-mode-map
|
2017-02-12 18:48:02 +00:00
|
|
|
:eval-after-load edebug
|
|
|
|
:bindings
|
|
|
|
"a" 'edebug-stop
|
2017-04-13 03:46:01 +00:00
|
|
|
"c" 'edebug-go-mode
|
2017-02-12 18:48:02 +00:00
|
|
|
"s" 'edebug-step-mode
|
2017-05-14 16:46:31 +00:00
|
|
|
"S" 'edebug-next-mode)
|
|
|
|
(evilified-state-evilify-map edebug-eval-mode-map
|
|
|
|
:eval-after-load edebug
|
|
|
|
:bindings
|
|
|
|
"a" 'edebug-stop
|
|
|
|
"c" 'edebug-go-mode
|
|
|
|
"s" 'edebug-step-mode
|
|
|
|
"S" 'edebug-next-mode)
|
2017-02-12 17:50:07 +00:00
|
|
|
(advice-add 'edebug-mode :after 'spacemacs//edebug-mode))))
|
2017-02-11 21:31:56 +00:00
|
|
|
|
2015-05-07 04:31:13 +00:00
|
|
|
(defun emacs-lisp/post-init-eldoc ()
|
|
|
|
(add-hook 'emacs-lisp-mode-hook 'eldoc-mode))
|
|
|
|
|
2015-10-15 12:18:53 +00:00
|
|
|
(defun emacs-lisp/init-auto-compile ()
|
|
|
|
(use-package auto-compile
|
2018-03-31 04:59:52 +00:00
|
|
|
:defer (spacemacs/defer)
|
2015-10-15 12:18:53 +00:00
|
|
|
:init
|
|
|
|
(progn
|
2018-03-31 04:59:52 +00:00
|
|
|
(spacemacs|require 'auto-compile)
|
2015-10-15 12:18:53 +00:00
|
|
|
(setq auto-compile-display-buffer nil
|
|
|
|
;; lets spaceline manage the mode-line
|
|
|
|
auto-compile-use-mode-line nil
|
|
|
|
auto-compile-mode-line-counter t)
|
|
|
|
(add-hook 'emacs-lisp-mode-hook 'auto-compile-mode))
|
|
|
|
:config
|
|
|
|
(progn
|
2017-02-13 13:38:37 +00:00
|
|
|
(spacemacs|hide-lighter auto-compile-mode)
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'emacs-lisp-mode
|
|
|
|
"cl" 'auto-compile-display-log))))
|
2015-10-15 12:18:53 +00:00
|
|
|
|
2015-05-07 04:31:13 +00:00
|
|
|
(defun emacs-lisp/init-elisp-slime-nav ()
|
|
|
|
;; Elisp go-to-definition with M-. and back again with M-,
|
|
|
|
(use-package elisp-slime-nav
|
2018-03-31 04:59:52 +00:00
|
|
|
:defer (spacemacs/defer)
|
2015-05-07 04:31:13 +00:00
|
|
|
:init
|
|
|
|
(progn
|
2018-03-31 04:59:52 +00:00
|
|
|
(spacemacs|require 'elisp-slime-nav)
|
2015-05-07 04:31:13 +00:00
|
|
|
(add-hook 'emacs-lisp-mode-hook 'elisp-slime-nav-mode)
|
2015-09-22 14:03:52 +00:00
|
|
|
(dolist (mode '(emacs-lisp-mode lisp-interaction-mode))
|
|
|
|
(spacemacs/declare-prefix-for-mode mode "mg" "find-symbol")
|
2019-11-15 10:49:24 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode
|
|
|
|
"gb" 'xref-pop-marker-stack)
|
2015-09-22 14:03:52 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode mode "mh" "help")
|
2019-12-07 00:42:55 +00:00
|
|
|
|
|
|
|
;; Load better help mode if helpful is installed
|
|
|
|
(if (configuration-layer/layer-used-p 'helpful)
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode
|
|
|
|
"hh" 'helpful-at-point)
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode
|
|
|
|
"hh" 'elisp-slime-nav-describe-elisp-thing-at-point))
|
2016-09-04 16:24:43 +00:00
|
|
|
(let ((jumpl (intern (format "spacemacs-jump-handlers-%S" mode))))
|
2017-02-13 13:38:37 +00:00
|
|
|
(add-to-list jumpl 'elisp-slime-nav-find-elisp-thing-at-point))))
|
2019-12-07 00:42:55 +00:00
|
|
|
:config (spacemacs|hide-lighter elisp-slime-nav-mode)))
|
2015-05-07 04:31:13 +00:00
|
|
|
|
2015-09-24 02:02:39 +00:00
|
|
|
(defun emacs-lisp/init-emacs-lisp ()
|
2015-09-22 14:03:52 +00:00
|
|
|
(dolist (mode '(emacs-lisp-mode lisp-interaction-mode))
|
2015-10-15 12:18:53 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode mode "mc" "compile")
|
2015-09-22 14:03:52 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode mode "me" "eval")
|
|
|
|
(spacemacs/declare-prefix-for-mode mode "mt" "tests")
|
2015-12-05 21:42:21 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode
|
2015-11-18 00:38:05 +00:00
|
|
|
"cc" 'emacs-lisp-byte-compile
|
|
|
|
"e$" 'lisp-state-eval-sexp-end-of-line
|
|
|
|
"eb" 'eval-buffer
|
2016-12-24 16:56:24 +00:00
|
|
|
"eC" 'spacemacs/eval-current-form
|
2015-11-18 00:38:05 +00:00
|
|
|
"ee" 'eval-last-sexp
|
|
|
|
"er" 'eval-region
|
|
|
|
"ef" 'eval-defun
|
|
|
|
"el" 'lisp-state-eval-sexp-end-of-line
|
2016-08-26 01:19:21 +00:00
|
|
|
"gG" 'spacemacs/nav-find-elisp-thing-at-point-other-window
|
2015-11-18 00:38:05 +00:00
|
|
|
"," 'lisp-state-toggle-lisp-state
|
|
|
|
"tb" 'spacemacs/ert-run-tests-buffer
|
2017-01-02 05:39:04 +00:00
|
|
|
"tq" 'ert)))
|
2015-09-24 02:02:39 +00:00
|
|
|
|
2015-05-09 23:23:49 +00:00
|
|
|
(defun emacs-lisp/init-macrostep ()
|
|
|
|
(use-package macrostep
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2017-09-24 15:04:59 +00:00
|
|
|
:mode (("\\*.el\\'" . emacs-lisp-mode)
|
|
|
|
("Cask\\'" . emacs-lisp-mode))
|
2015-05-09 23:23:49 +00:00
|
|
|
:init
|
|
|
|
(progn
|
2015-11-01 20:48:57 +00:00
|
|
|
(evil-define-key 'normal macrostep-keymap "q" 'macrostep-collapse-all)
|
2016-01-20 02:55:38 +00:00
|
|
|
(spacemacs|define-transient-state macrostep
|
|
|
|
:title "MacroStep Transient State"
|
2016-01-14 02:43:45 +00:00
|
|
|
:doc "\n[_e_] expand [_c_] collapse [_n_/_N_] next/previous [_q_] quit"
|
|
|
|
:foreign-keys run
|
2015-05-09 23:23:49 +00:00
|
|
|
:bindings
|
|
|
|
("e" macrostep-expand)
|
|
|
|
("c" macrostep-collapse)
|
|
|
|
("n" macrostep-next-macro)
|
|
|
|
("N" macrostep-prev-macro)
|
2016-01-14 02:43:45 +00:00
|
|
|
("q" macrostep-collapse-all :exit t))
|
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'emacs-lisp-mode
|
2016-01-20 02:55:38 +00:00
|
|
|
"dm" 'spacemacs/macrostep-transient-state/body))))
|
2015-05-09 23:23:49 +00:00
|
|
|
|
2017-10-03 20:06:37 +00:00
|
|
|
(defun emacs-lisp/init-nameless ()
|
|
|
|
(use-package nameless
|
2018-03-31 04:59:52 +00:00
|
|
|
:defer (spacemacs/defer)
|
2017-10-25 17:45:56 +00:00
|
|
|
:init
|
|
|
|
(progn
|
2018-03-31 04:59:52 +00:00
|
|
|
(spacemacs|require 'nameless)
|
2017-12-18 04:25:04 +00:00
|
|
|
(setq
|
|
|
|
;; always show the separator since it can have a semantic purpose
|
|
|
|
;; like in Spacemacs where - is variable and / is a function.
|
|
|
|
;; moreover it makes nameless work for all kind of separators.
|
|
|
|
nameless-separator nil
|
|
|
|
;; Use > as the defautl prefix : is already used for
|
|
|
|
;; keywords
|
|
|
|
nameless-prefix ">")
|
|
|
|
;; some default aliases for Spacemacs source code
|
|
|
|
(setq nameless-global-aliases '(("SB" . "spacemacs-buffer")
|
|
|
|
("S" . "spacemacs")
|
2018-01-04 07:13:22 +00:00
|
|
|
(".S" . "dotspacemacs")
|
2017-12-18 04:25:04 +00:00
|
|
|
("CL" . "configuration-layer")))
|
|
|
|
;; make `nameless-current-name' safe as a local variable for string values
|
|
|
|
(put 'nameless-current-name 'safe-local-variable #'stringp)
|
2018-01-04 05:40:58 +00:00
|
|
|
(spacemacs|diminish nameless-mode " 🅽" " [n]")
|
2017-10-25 17:45:56 +00:00
|
|
|
(spacemacs|add-toggle nameless
|
|
|
|
:status nameless-mode
|
|
|
|
:on (nameless-mode)
|
|
|
|
:off (nameless-mode -1)
|
2019-04-30 22:59:03 +00:00
|
|
|
:documentation "Hide package namespaces in your emacs-lisp code."
|
2018-01-04 05:40:58 +00:00
|
|
|
:evil-leader-for-mode (emacs-lisp-mode . "Tn"))
|
2018-06-03 05:48:53 +00:00
|
|
|
;; activate nameless only when in a GUI
|
|
|
|
;; in a terminal nameless triggers all sorts of graphical glitches.
|
|
|
|
(spacemacs|do-after-display-system-init
|
|
|
|
(when emacs-lisp-hide-namespace-prefix
|
|
|
|
(spacemacs/toggle-nameless-on-register-hook-emacs-lisp-mode))))))
|
2017-10-03 20:06:37 +00:00
|
|
|
|
2017-09-24 15:23:50 +00:00
|
|
|
(defun emacs-lisp/init-overseer ()
|
|
|
|
(use-package overseer
|
2018-03-04 04:37:53 +00:00
|
|
|
:defer t
|
2017-09-24 15:23:50 +00:00
|
|
|
:init (spacemacs/set-leader-keys-for-major-mode 'emacs-lisp-mode
|
|
|
|
"ta" 'overseer-test
|
|
|
|
"tt" 'overseer-test-run-test
|
|
|
|
"tb" 'overseer-test-this-buffer
|
|
|
|
"tf" 'overseer-test-file
|
|
|
|
"tg" 'overseer-test-tags
|
|
|
|
"tp" 'overseer-test-prompt
|
|
|
|
"tA" 'overseer-test-debug
|
|
|
|
"tq" 'overseer-test-quiet
|
|
|
|
"tv" 'overseer-test-verbose
|
|
|
|
"th" 'overseer-help)))
|
|
|
|
|
2015-05-07 04:31:13 +00:00
|
|
|
(defun emacs-lisp/post-init-evil ()
|
2018-06-01 06:59:57 +00:00
|
|
|
(add-hook 'emacs-lisp-mode-hook #'spacemacs//define-elisp-comment-text-object))
|
2015-05-07 04:31:13 +00:00
|
|
|
|
2018-01-04 06:34:23 +00:00
|
|
|
(defun emacs-lisp/pre-init-evil-cleverparens ()
|
|
|
|
(spacemacs|use-package-add-hook evil-cleverparens
|
|
|
|
:pre-init
|
|
|
|
(add-to-list 'evil-lisp-safe-structural-editing-modes 'emacs-lisp-mode)))
|
|
|
|
|
2018-06-11 03:24:44 +00:00
|
|
|
(defun emacs-lisp/post-init-eval-sexp-fu ()
|
|
|
|
(add-hook 'emacs-lisp-mode-hook 'eval-sexp-fu-flash-mode))
|
|
|
|
|
2015-08-14 02:40:29 +00:00
|
|
|
(defun emacs-lisp/post-init-flycheck ()
|
2015-10-12 14:01:51 +00:00
|
|
|
;; Don't activate flycheck by default in elisp
|
|
|
|
;; because of too much false warnings
|
2017-02-14 03:27:29 +00:00
|
|
|
;; (spacemacs/enable-flycheck 'emacs-lisp-mode)
|
2015-12-09 11:29:19 +00:00
|
|
|
|
2015-08-14 02:40:29 +00:00
|
|
|
;; Make flycheck recognize packages in loadpath
|
|
|
|
;; i.e (require 'company) will not give an error now
|
|
|
|
(setq flycheck-emacs-lisp-load-path 'inherit))
|
|
|
|
|
2019-04-10 03:45:05 +00:00
|
|
|
(defun emacs-lisp/init-flycheck-package ()
|
|
|
|
(use-package flycheck-package
|
2019-04-18 10:39:22 +00:00
|
|
|
:hook (emacs-lisp-mode . flycheck-package-setup)))
|
2019-04-10 03:45:05 +00:00
|
|
|
|
2017-08-26 21:18:09 +00:00
|
|
|
(defun emacs-lisp/post-init-counsel-gtags ()
|
|
|
|
(spacemacs/counsel-gtags-define-keys-for-mode 'emacs-lisp-mode))
|
|
|
|
|
2016-04-05 04:08:34 +00:00
|
|
|
(defun emacs-lisp/post-init-helm-gtags ()
|
|
|
|
(spacemacs/helm-gtags-define-keys-for-mode 'emacs-lisp-mode))
|
|
|
|
|
|
|
|
(defun emacs-lisp/post-init-ggtags ()
|
2016-08-15 19:24:44 +00:00
|
|
|
(add-hook 'emacs-lisp-mode-local-vars-hook #'spacemacs/ggtags-mode-enable))
|
2016-04-05 04:08:34 +00:00
|
|
|
|
2017-05-29 09:35:22 +00:00
|
|
|
(defun emacs-lisp/post-init-parinfer ()
|
|
|
|
(add-hook 'emacs-lisp-mode-hook 'parinfer-mode))
|
|
|
|
|
2015-05-07 04:31:13 +00:00
|
|
|
(defun emacs-lisp/post-init-semantic ()
|
2016-03-10 13:29:19 +00:00
|
|
|
(add-hook 'emacs-lisp-mode-hook 'semantic-mode)
|
2015-09-29 05:07:57 +00:00
|
|
|
(with-eval-after-load 'semantic
|
|
|
|
(semantic-default-elisp-setup)))
|
2015-05-07 04:31:13 +00:00
|
|
|
|
|
|
|
(defun emacs-lisp/post-init-srefactor ()
|
2018-01-18 04:03:00 +00:00
|
|
|
(add-hook 'emacs-lisp-mode-hook 'spacemacs/load-srefactor)
|
2015-05-07 04:31:13 +00:00
|
|
|
(use-package srefactor-lisp
|
|
|
|
:commands (srefactor-lisp-format-buffer
|
|
|
|
srefactor-lisp-format-defun
|
|
|
|
srefactor-lisp-format-sexp
|
|
|
|
srefactor-lisp-one-line)
|
|
|
|
:init
|
2015-09-22 14:03:52 +00:00
|
|
|
(dolist (mode '(emacs-lisp-mode lisp-interaction-mode))
|
2016-05-07 12:02:17 +00:00
|
|
|
(spacemacs/declare-prefix-for-mode mode "m=" "srefactor")
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode
|
|
|
|
"=b" 'srefactor-lisp-format-buffer
|
|
|
|
"=d" 'srefactor-lisp-format-defun
|
|
|
|
"=o" 'srefactor-lisp-one-line
|
|
|
|
"=s" 'srefactor-lisp-format-sexp))))
|
2015-09-22 14:03:52 +00:00
|
|
|
|
|
|
|
(defun emacs-lisp/post-init-smartparens ()
|
|
|
|
(dolist (mode '(emacs-lisp-mode lisp-interaction-mode))
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode mode
|
|
|
|
"ec" 'spacemacs/eval-current-form-sp
|
|
|
|
"es" 'spacemacs/eval-current-symbol-sp)))
|