2014-11-29 04:59:23 +00:00
|
|
|
(defvar erlang-elixir-packages
|
|
|
|
'(
|
|
|
|
auto-complete
|
|
|
|
auto-highlight-symbol
|
|
|
|
edts
|
|
|
|
elixir-mode
|
|
|
|
erlang
|
|
|
|
flycheck
|
|
|
|
git-gutter-fringe
|
2014-12-18 02:26:52 +00:00
|
|
|
evil-iedit-state
|
2014-11-29 04:59:23 +00:00
|
|
|
rainbow-delimiters
|
|
|
|
ruby-end
|
|
|
|
smartparens
|
|
|
|
yasnippet
|
|
|
|
)
|
|
|
|
"List of all packages to install and/or initialize. Built-in packages
|
|
|
|
which require an initialization must be listed explicitly in the list.")
|
|
|
|
|
|
|
|
(defvar erlang-elixir-excluded-packages '()
|
|
|
|
"List of packages to exclude.")
|
|
|
|
|
2014-12-07 15:21:27 +00:00
|
|
|
(defvar spacemacs-erlang-elixir-use-edts nil
|
|
|
|
"If non-nil then `EDTS' is loaded with `erlang-mode'. This variable
|
|
|
|
must be defined in `dotspacemacs/init' function to take effect.")
|
|
|
|
|
2014-11-29 06:53:14 +00:00
|
|
|
(defun erlang-elixir/init-auto-complete ()
|
2014-11-29 04:59:23 +00:00
|
|
|
(add-hook 'erlang-mode-hook 'auto-complete-mode))
|
|
|
|
|
2014-11-29 06:53:14 +00:00
|
|
|
(defun erlang-elixir/init-auto-highlight-symbol ()
|
2014-11-29 04:59:23 +00:00
|
|
|
(add-hook 'erlang-mode-hook 'auto-highlight-symbol-mode))
|
|
|
|
|
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
|
|
|
|
(require 'ruby-end)
|
|
|
|
(add-to-list 'elixir-mode-hook
|
|
|
|
(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 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
|
|
|
|
: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
|
|
|
|
"mg" 'edts-find-source-under-point
|
|
|
|
"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-git-gutter-fringe ()
|
2014-11-29 04:59:23 +00:00
|
|
|
(add-hook 'erlang-mode-hook 'git-gutter-mode))
|
|
|
|
|
2014-12-18 02:26:52 +00:00
|
|
|
(defun erlang-elixir/init-evil-iedit-state ()
|
|
|
|
(add-hook 'erlang-mode-hook 'spacemacs/evil-state-lazy-loading))
|
|
|
|
|
|
|
|
|
2014-11-29 06:53:14 +00:00
|
|
|
(defun erlang-elixir/init-rainbow-delimiters ()
|
2014-11-29 04:59:23 +00:00
|
|
|
(add-hook 'erlang-mode-hook 'turn-on-rainbow-delimiters-mode))
|
|
|
|
|
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
|
2014-12-04 03:39:18 +00:00
|
|
|
:config (spacemacs|hide-lighter ruby-end-mode)))
|
2014-11-29 04:59:23 +00:00
|
|
|
|
2014-11-29 06:53:14 +00:00
|
|
|
(defun erlang-elixir/init-smartparens ()
|
2014-12-12 05:08:30 +00:00
|
|
|
(add-hook 'erlang-mode-hook
|
|
|
|
(if dotspacemacs-smartparens-strict-mode
|
|
|
|
'smartparens-strict-mode
|
|
|
|
'smartparens-mode)))
|
2014-11-29 04:59:23 +00:00
|
|
|
|
2014-11-29 06:53:14 +00:00
|
|
|
(defun erlang-elixir/init-yasnippet ()
|
2014-11-29 04:59:23 +00:00
|
|
|
(add-hook 'erlang-mode-hook 'spacemacs/load-yasnippet))
|