2015-01-14 04:12:56 +00:00
|
|
|
;;; packages.el --- Erlang and Elixir 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-11-29 04:59:23 +00:00
|
|
|
(defvar erlang-elixir-packages
|
|
|
|
'(
|
2015-01-20 22:28:32 +00:00
|
|
|
alchemist
|
2014-11-29 04:59:23 +00:00
|
|
|
edts
|
|
|
|
elixir-mode
|
|
|
|
erlang
|
|
|
|
flycheck
|
|
|
|
ruby-end
|
|
|
|
)
|
|
|
|
"List of all packages to install and/or initialize. Built-in packages
|
|
|
|
which require an initialization must be listed explicitly in the list.")
|
|
|
|
|
2015-01-20 22:28:32 +00:00
|
|
|
(defun erlang-elixir/init-alchemist ()
|
|
|
|
(add-hook 'elixir-mode-hook 'alchemist-mode)
|
|
|
|
(setq alchemist-project-compile-when-needed t)
|
|
|
|
(evil-leader/set-key-for-mode 'elixir-mode
|
|
|
|
"mcb" 'alchemist-compile-this-buffer
|
2015-02-18 03:11:41 +00:00
|
|
|
|
|
|
|
"mel" 'alchemist-eval-current-line
|
|
|
|
"meL" 'alchemist-eval-print-current-line
|
|
|
|
"mer" 'alchemist-eval-region
|
|
|
|
"meR" 'alchemist-eval-print-region
|
|
|
|
"meb" 'alchemist-eval-buffer
|
|
|
|
"meB" 'alchemist-eval-print-buffer
|
|
|
|
|
|
|
|
"mgt" 'alchemist-project-open-tests-for-current-file
|
|
|
|
|
2015-01-20 22:28:32 +00:00
|
|
|
"mh:" 'alchemist-help
|
|
|
|
"mhH" 'alchemist-help-history
|
|
|
|
"mhh" 'alchemist-help-search-at-point
|
|
|
|
"mhr" 'alchemist-help-search-marked-region
|
2015-02-18 03:11:41 +00:00
|
|
|
|
|
|
|
"mm:" 'alchemist-mix
|
|
|
|
"mmc" 'alchemist-mix-compile
|
|
|
|
"mmx" 'alchemist-mix-run
|
|
|
|
"mmh" 'alchemist-mix-help
|
2015-01-20 22:28:32 +00:00
|
|
|
"mmi" 'alchemist-iex-project-run
|
2015-02-18 03:11:41 +00:00
|
|
|
|
|
|
|
"msi" 'alchemist-iex-run
|
2015-01-20 22:28:32 +00:00
|
|
|
"msl" 'alchemist-iex-send-current-line
|
|
|
|
"msL" 'alchemist-iex-send-current-line-and-go
|
|
|
|
"msr" 'alchemist-iex-send-region
|
|
|
|
"msR" 'alchemist-iex-send-region-and-go
|
2015-02-18 03:11:41 +00:00
|
|
|
|
|
|
|
"mta" 'alchemist-mix-test
|
|
|
|
"mtb" 'alchemist-mix-test-this-buffer
|
|
|
|
"mtt" 'alchemist-mix-test-at-point
|
|
|
|
|
|
|
|
"mxb" 'alchemist-execute-this-buffer
|
|
|
|
"mxf" 'alchemist-execute-file
|
|
|
|
"mx:" 'alchemist-execute
|
|
|
|
))
|
2015-01-20 22:28:32 +00:00
|
|
|
|
2014-12-07 15:21:27 +00:00
|
|
|
(defun erlang-elixir/init-edts ()
|
|
|
|
|
|
|
|
(defun erlang-elixir//load-edts ()
|
|
|
|
"Return non-nil if EDTS can be loaded."
|
|
|
|
(and spacemacs-erlang-elixir-use-edts
|
|
|
|
(not (eq window-system 'w32))))
|
|
|
|
|
|
|
|
(defun erlang-elixir//edts-start ()
|
|
|
|
"Starts EDTS."
|
|
|
|
(if (erlang-elixir//load-edts)
|
|
|
|
(require 'edts-start))))
|
|
|
|
|
2014-11-29 06:53:14 +00:00
|
|
|
(defun erlang-elixir/init-elixir-mode ()
|
2014-11-29 04:59:23 +00:00
|
|
|
(use-package elixir-mode
|
|
|
|
:defer t
|
|
|
|
:config
|
|
|
|
(progn
|
2015-02-20 12:29:24 +00:00
|
|
|
(defun auto-activate-ruby-end-mode-for-elixir-mode ()
|
|
|
|
(set (make-variable-buffer-local 'ruby-end-expand-keywords-before-re)
|
|
|
|
"\\(?:^\\|\\s-+\\)\\(?:do\\)")
|
|
|
|
(set (make-variable-buffer-local 'ruby-end-check-statement-modifiers)
|
|
|
|
nil)
|
|
|
|
(ruby-end-mode +1))
|
2014-11-29 04:59:23 +00:00
|
|
|
(add-to-list 'elixir-mode-hook
|
2015-02-20 12:29:24 +00:00
|
|
|
'auto-activate-ruby-end-mode-for-elixir-mode))))
|
2014-11-29 04:59:23 +00:00
|
|
|
|
2014-11-29 06:53:14 +00:00
|
|
|
(defun erlang-elixir/init-erlang ()
|
2014-11-29 04:59:23 +00:00
|
|
|
(use-package erlang
|
|
|
|
:mode (("\\.erl?$" . erlang-mode)
|
|
|
|
("\\.hrl?$" . erlang-mode)
|
|
|
|
("\\.spec?$" . erlang-mode))
|
|
|
|
:defer t
|
2015-01-17 04:29:07 +00:00
|
|
|
:init
|
|
|
|
(add-hook 'erlang-mode-hook (lambda () (run-hooks 'prog-mode-hook)))
|
2014-11-29 04:59:23 +00:00
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(setq erlang-root-dir "/usr/lib/erlang/erts-5.10.3")
|
|
|
|
(add-to-list 'exec-path "/usr/lib/erlang/erts-5.10.3/bin")
|
|
|
|
(setq erlang-man-root-dir "/usr/lib/erlang/erts-5.10.3/man")
|
|
|
|
(setq erlang-compile-extra-opts '(debug_info))
|
|
|
|
(require 'erlang-start)
|
|
|
|
(add-hook 'erlang-mode-hook
|
|
|
|
(lambda ()
|
|
|
|
(setq mode-name "Erlang")
|
|
|
|
;; when starting an Erlang shell in Emacs, with a custom node name
|
|
|
|
(setq inferior-erlang-machine-options '("-sname" "syl20bnr"))
|
|
|
|
))
|
2014-12-07 15:21:27 +00:00
|
|
|
(if (and (fboundp 'erlang-elixir//load-edts)
|
|
|
|
(erlang-elixir//load-edts))
|
|
|
|
(erlang-elixir//edts-start))
|
2014-11-29 04:59:23 +00:00
|
|
|
;; (setq edts-log-level 'debug)
|
|
|
|
;; (setq edts-face-inhibit-mode-line-updates t)
|
|
|
|
(evil-leader/set-key-for-mode 'erlang-mode
|
2014-12-22 03:52:57 +00:00
|
|
|
"me" 'edts-code-next-issue
|
|
|
|
"mGg" 'edts-find-global-function
|
|
|
|
"mGh" 'edts-find-header-source
|
|
|
|
"mGl" 'edts-find-local-function
|
|
|
|
"mGr" 'edts-find-record-source
|
2015-01-21 03:32:13 +00:00
|
|
|
"mgg" 'edts-find-source-under-point
|
2014-12-22 03:52:57 +00:00
|
|
|
"mhd" 'edts-find-doc
|
|
|
|
"mm" 'edts-find-macro-source))))
|
2014-11-29 04:59:23 +00:00
|
|
|
|
2014-11-29 06:53:14 +00:00
|
|
|
(defun erlang-elixir/init-flycheck ()
|
2014-12-08 04:40:07 +00:00
|
|
|
(add-hook 'elixir-mode-hook 'flycheck-mode)
|
|
|
|
(unless spacemacs-erlang-elixir-use-edts
|
|
|
|
(add-hook 'erlang-mode-hook 'flycheck-mode)))
|
2014-11-29 04:59:23 +00:00
|
|
|
|
2014-11-29 06:53:14 +00:00
|
|
|
(defun erlang-elixir/init-ruby-end ()
|
2014-11-29 04:59:23 +00:00
|
|
|
(use-package ruby-end
|
|
|
|
:defer t
|
2015-02-20 12:29:24 +00:00
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(spacemacs|hide-lighter ruby-end-mode)
|
|
|
|
;; hack to remove the autoloaded `add-hook' in `ruby-end'
|
|
|
|
(remove-hook 'ruby-mode-hook 'ruby-end-mode)
|
|
|
|
(remove-hook 'enh-ruby-mode-hook 'ruby-end-mode))))
|