2015-08-02 13:04:12 +00:00
|
|
|
;;; packages.el --- elm 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
|
|
|
|
|
|
|
|
(setq elm-packages
|
|
|
|
'(
|
|
|
|
company
|
|
|
|
elm-mode
|
|
|
|
flycheck
|
|
|
|
flycheck-elm
|
|
|
|
popwin
|
|
|
|
smartparens
|
|
|
|
))
|
|
|
|
|
2015-09-07 03:14:31 +00:00
|
|
|
(defun elm/post-init-company ()
|
|
|
|
(spacemacs|add-company-hook elm-mode)
|
|
|
|
(add-hook 'elm-mode-hook 'elm-oracle-setup-completion))
|
|
|
|
|
|
|
|
(defun elm/post-init-flycheck ()
|
|
|
|
(add-hook 'elm-mode-hook 'flycheck-mode))
|
2015-08-02 13:04:12 +00:00
|
|
|
|
2015-09-07 03:14:31 +00:00
|
|
|
(when (configuration-layer/layer-usedp 'syntax-checking)
|
|
|
|
(defun elm/init-flycheck-elm ()
|
|
|
|
"Initialize flycheck-elm"
|
|
|
|
(use-package flycheck-elm
|
|
|
|
:if (configuration-layer/package-usedp 'flycheck)
|
|
|
|
:defer t
|
|
|
|
:init (add-hook 'flycheck-mode-hook 'flycheck-elm-setup t))))
|
2015-08-02 13:04:12 +00:00
|
|
|
|
|
|
|
(defun elm/init-elm-mode ()
|
|
|
|
"Initialize elm-mode"
|
|
|
|
(use-package elm-mode
|
|
|
|
:mode ("\\.elm\\'" . elm-mode)
|
|
|
|
:init
|
|
|
|
(progn
|
|
|
|
(defun spacemacs/init-elm-mode ()
|
|
|
|
"Disable electric-indent-mode and let indentation cycling feature work"
|
|
|
|
(if (fboundp 'electric-indent-local-mode)
|
|
|
|
(electric-indent-local-mode -1)))
|
|
|
|
|
2015-09-07 03:14:31 +00:00
|
|
|
(add-hook 'elm-mode-hook 'spacemacs/init-elm-mode))
|
2015-08-02 13:04:12 +00:00
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(push "\\*elm\\*" spacemacs-useful-buffers-regexp)
|
|
|
|
|
|
|
|
(defun spacemacs/elm-compile-buffer-output ()
|
|
|
|
(interactive)
|
|
|
|
(let* ((fname (format "%s.js" (downcase (file-name-base (buffer-file-name))))))
|
|
|
|
(elm-compile--file (elm--buffer-local-file-name) fname)))
|
|
|
|
|
2015-11-17 17:56:31 +00:00
|
|
|
(defun spacemacs/elm-repl-push-decl-focus ()
|
2015-09-07 03:14:31 +00:00
|
|
|
"Send current function to the REPL and focus it in insert state."
|
|
|
|
(interactive)
|
2015-11-17 17:56:31 +00:00
|
|
|
(elm-repl-push-decl)
|
2015-09-07 03:14:31 +00:00
|
|
|
(run-elm-interactive)
|
|
|
|
(evil-insert-state))
|
|
|
|
|
2015-11-17 17:56:31 +00:00
|
|
|
(defun spacemacs/elm-repl-push-focus ()
|
2015-09-07 03:14:31 +00:00
|
|
|
"Send current region to the REPL and focus it in insert state."
|
2015-11-17 17:56:31 +00:00
|
|
|
(elm-repl-push)
|
2015-09-07 03:14:31 +00:00
|
|
|
(run-elm-interactive)
|
|
|
|
(evil-insert-state))
|
|
|
|
|
2015-11-18 00:38:05 +00:00
|
|
|
(spacemacs/set-leader-keys-for-major-mode 'elm-mode
|
2015-08-02 13:04:12 +00:00
|
|
|
;; make
|
2015-11-18 00:38:05 +00:00
|
|
|
"cb" 'elm-compile-buffer
|
|
|
|
"cB" 'spacemacs/elm-compile-buffer-output
|
|
|
|
"cm" 'elm-compile-main
|
2015-08-02 13:04:12 +00:00
|
|
|
|
|
|
|
;; oracle
|
2015-11-18 00:38:05 +00:00
|
|
|
"ht" 'elm-oracle-type-at-point
|
2015-08-02 13:04:12 +00:00
|
|
|
|
|
|
|
;; repl
|
2015-11-18 00:38:05 +00:00
|
|
|
"si" 'elm-repl-load
|
2015-11-17 17:56:31 +00:00
|
|
|
"sf" 'elm-repl-push-decl
|
2015-11-24 15:35:48 +00:00
|
|
|
"sF" 'spacemacs/elm-repl-push-decl-focus
|
2015-11-17 17:56:31 +00:00
|
|
|
"sr" 'elm-repl-push
|
|
|
|
"sR" 'spacemacs/elm-repl-push-focus
|
2015-08-02 13:04:12 +00:00
|
|
|
|
|
|
|
;; reactor
|
2015-11-18 00:38:05 +00:00
|
|
|
"Rn" 'elm-preview-buffer
|
|
|
|
"Rm" 'elm-preview-main
|
2015-08-02 13:04:12 +00:00
|
|
|
|
|
|
|
;; package
|
2015-11-18 00:38:05 +00:00
|
|
|
"pi" 'elm-import
|
|
|
|
"pc" 'elm-package-catalog
|
|
|
|
"pd" 'elm-documentation-lookup)
|
2015-08-02 13:04:12 +00:00
|
|
|
|
2015-11-23 19:27:36 +00:00
|
|
|
(dolist (x '(("mR" . "reactor")
|
|
|
|
("mc" . "compile")
|
|
|
|
("mh" . "help")
|
|
|
|
("mp" . "package")
|
|
|
|
("ms" . "repl")))
|
|
|
|
(spacemacs/declare-prefix-for-mode 'elm-mode (car x) (cdr x)))
|
|
|
|
|
2015-11-21 10:07:14 +00:00
|
|
|
(evilified-state-evilify elm-package-mode elm-package-mode-map
|
|
|
|
"g" 'elm-package-refresh
|
|
|
|
"n" 'elm-package-next
|
|
|
|
"p" 'elm-package-prev
|
|
|
|
"v" 'elm-package-view
|
|
|
|
"m" 'elm-package-mark
|
|
|
|
"u" 'elm-package-unmark
|
|
|
|
"x" 'elm-package-install
|
|
|
|
"q" 'quit-window))))
|
2015-08-02 13:04:12 +00:00
|
|
|
|
|
|
|
(defun elm/pre-init-popwin ()
|
|
|
|
(spacemacs|use-package-add-hook popwin
|
|
|
|
:post-config
|
|
|
|
(push '("*elm*" :tail t :noselect t) popwin:special-display-config)
|
2015-09-07 03:14:31 +00:00
|
|
|
(push '("*elm-make*" :tail t :noselect t) popwin:special-display-config)))
|
2015-08-02 13:04:12 +00:00
|
|
|
|
|
|
|
(defun elm/post-init-smartparens ()
|
|
|
|
(if dotspacemacs-smartparens-strict-mode
|
|
|
|
(add-hook 'elm-mode-hook #'smartparens-strict-mode)
|
|
|
|
(add-hook 'elm-mode-hook #'smartparens-mode)))
|