2015-01-14 04:12:56 +00:00
|
|
|
;;; packages.el --- Scala Layer packages File for Spacemacs
|
|
|
|
;;
|
|
|
|
;; Copyright (c) 2012-2014 Sylvain Benner
|
|
|
|
;; Copyright (c) 2014-2015 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
|
|
|
|
|
2014-12-14 10:21:59 +00:00
|
|
|
(defvar scala-packages
|
2014-12-14 04:29:23 +00:00
|
|
|
'(
|
|
|
|
ensime
|
|
|
|
sbt-mode
|
|
|
|
scala-mode2
|
|
|
|
)
|
|
|
|
"List of all packages to install and/or initialize. Built-in packages
|
|
|
|
which require an initialization must be listed explicitly in the list.")
|
|
|
|
|
2014-12-30 21:51:41 +00:00
|
|
|
(defun scala/init-ensime ()
|
2014-12-14 04:29:23 +00:00
|
|
|
(use-package ensime
|
2014-12-29 20:47:56 +00:00
|
|
|
:commands (ensime-mode)
|
|
|
|
:init
|
2015-01-03 02:29:02 +00:00
|
|
|
(progn
|
|
|
|
(add-hook 'scala-mode-hook 'scala/configure-flyspell)
|
2015-01-03 04:18:31 +00:00
|
|
|
(add-hook 'scala-mode-hook 'scala/configure-ensime))
|
2014-12-29 20:40:56 +00:00
|
|
|
:config
|
|
|
|
(progn
|
2015-01-03 02:30:17 +00:00
|
|
|
(evil-define-key 'insert ensime-mode-map (kbd ".") 'scala/completing-dot)
|
|
|
|
|
2014-12-29 20:40:56 +00:00
|
|
|
(evil-define-key 'normal ensime-popup-buffer-map
|
|
|
|
(kbd "q") 'ensime-popup-buffer-quit-function)
|
|
|
|
|
|
|
|
(evil-define-key 'normal ensime-refactor-info-map
|
|
|
|
(kbd "q") 'spacemacs/ensime-refactor-cancel
|
|
|
|
(kbd "c") 'spacemacs/ensime-refactor-accept
|
|
|
|
(kbd "RET") 'spacemacs/ensime-refactor-accept)
|
|
|
|
|
|
|
|
(evil-define-key 'normal ensime-compile-result-map
|
|
|
|
(kbd "g") 'ensime-show-all-errors-and-warnings
|
|
|
|
(kbd "TAB") 'forward-button
|
|
|
|
(kbd "<backtab>") 'backward-button
|
|
|
|
(kbd "M-n") 'forward-button
|
2014-12-30 22:19:43 +00:00
|
|
|
(kbd "M-p") 'backward-button
|
|
|
|
(kbd "n") 'forward-button
|
|
|
|
(kbd "N") 'backward-button)
|
2014-12-29 20:59:27 +00:00
|
|
|
|
|
|
|
;; Don't use scala checker if ensime mode is active, since it provides
|
|
|
|
;; better error checking.
|
|
|
|
(eval-after-load 'flycheck
|
|
|
|
'(progn
|
2015-01-03 02:31:13 +00:00
|
|
|
(defun scala/disable-flycheck () (flycheck-mode -1))
|
|
|
|
(add-hook 'ensime-mode-hook 'scala/disable-flycheck))))))
|
2014-12-29 21:00:07 +00:00
|
|
|
|
2014-12-30 21:51:41 +00:00
|
|
|
(defun scala/init-scala-mode2 ()
|
2014-12-29 21:00:07 +00:00
|
|
|
(use-package scala-mode2
|
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(dolist (ext '(".cfe" ".cfs" ".si" ".gen" ".lock"))
|
|
|
|
(add-to-list 'completion-ignored-extensions ext))
|
|
|
|
:config
|
|
|
|
(progn
|
2014-12-30 21:53:03 +00:00
|
|
|
(evil-define-key 'normal scala-mode-map "J" 'spacemacs/scala-join-line)
|
|
|
|
|
2014-12-29 21:00:07 +00:00
|
|
|
;; Compatibility with `aggressive-indent'
|
|
|
|
(custom-set-variables
|
2014-12-30 21:52:17 +00:00
|
|
|
'(scala-indent:align-forms t)
|
|
|
|
'(scala-indent:align-parameters t)
|
|
|
|
'(scala-indent:default-run-on-strategy scala-indent:operator-strategy))
|
2014-12-29 21:00:07 +00:00
|
|
|
|
2015-01-23 03:28:35 +00:00
|
|
|
(require 'noflet)
|
|
|
|
|
2014-12-29 21:00:07 +00:00
|
|
|
(defadvice scala-indent:indent-code-line (around retain-trailing-ws activate)
|
|
|
|
"Keep trailing-whitespace when indenting."
|
|
|
|
(noflet ((scala-lib:delete-trailing-whitespace ()))
|
|
|
|
ad-do-it)))))
|