Move Erlang and Elixir in a contribution layer

This commit is contained in:
syl20bnr 2014-11-28 23:59:23 -05:00
parent 0c87b4dab5
commit b9e9b32168
4 changed files with 131 additions and 96 deletions

View file

@ -98,7 +98,6 @@
- [Modes](#modes)
- [Helm](#helm)
- [Experimental Helm feature](#experimental-helm-feature)
- [Erlang](#erlang)
- [Ledger](#ledger)
- [Org](#org)
- [Perforce](#perforce)
@ -1572,21 +1571,6 @@ Key Binding | Description
<kbd>0</kbd> | execute action 9
<kbd>a</kbd> | toggle action selection menu
### Erlang
`Spacemacs` uses [EDTS][edts] as an Erlang coding environment.
Key Binding | Description
----------------------|------------------------------------------------------------
<kbd>SPC m d</kbd> | show man page documentation
<kbd>SPC m e</kbd> | go to next issue
<kbd>SPC m g</kbd> | go to definition
<kbd>SPC m G</kbd> | find a module in the current project
<kbd>SPC m h</kbd> | open the header file under point
<kbd>SPC m l</kbd> | find a function in the current module
<kbd>SPC m m</kbd> | go to the macro definition under point
<kbd>SPC m r</kbd> | go to the record definition under point
### Ledger
Key Binding | Description

View file

@ -0,0 +1,27 @@
# Erlang/Elixir contribution layer for Spacemacs
## Install
To use this contribution add it to your `~/.spacemacs`
```elisp
(defvar dotspacemacs-configuration-layers '(erlang-elixir)
"List of contribution to load."
)
```
### Erlang
`Spacemacs` uses [EDTS][edts] as an Erlang coding environment.
Key Binding | Description
--------------------|------------------------------------------------------------
<kbd>SPC m d</kbd> | show man page documentation
<kbd>SPC m e</kbd> | go to next issue
<kbd>SPC m g</kbd> | go to definition
<kbd>SPC m G</kbd> | find a module in the current project
<kbd>SPC m h</kbd> | open the header file under point
<kbd>SPC m l</kbd> | find a function in the current module
<kbd>SPC m m</kbd> | go to the macro definition under point
<kbd>SPC m r</kbd> | go to the record definition under point

View file

@ -0,0 +1,98 @@
(defvar erlang-elixir-packages
'(
auto-complete
auto-highlight-symbol
edts
elixir-mix
elixir-mode
erlang
flycheck
git-gutter-fringe
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.")
(defun spacemacs/init-auto-complete ()
(add-hook 'erlang-mode-hook 'auto-complete-mode))
(defun spacemacs/init-auto-highlight-symbol ()
(add-hook 'erlang-mode-hook 'auto-highlight-symbol-mode))
(defun spacemacs/init-elixir-mix ()
(use-package elixir-mix
:defer t
:init
(global-elixir-mix-mode)))
(defun spacemacs/init-elixir-mode ()
(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))))))
(defun spacemacs/init-erlang ()
(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"))
))
(unless (eq window-system 'w32)
(require 'edts-start))
;; (setq edts-log-level 'debug)
;; (setq edts-face-inhibit-mode-line-updates t)
(evil-leader/set-key-for-mode 'erlang-mode
"md" 'edts-find-doc
"me" 'edts-code-next-issue
"mG" 'edts-find-global-function
"mg" 'edts-find-source-under-point
"mh" 'edts-find-header-source
"ml" 'edts-find-local-function
"mm" 'edts-find-macro-source
"mr" 'edts-find-record-source))))
(defun spacemacs/init-flycheck ()
(add-hook 'elixir-mode-hook 'flycheck-mode))
(defun spacemacs/init-git-gutter-fringe ()
(add-hook 'erlang-mode-hook 'git-gutter-mode))
(defun spacemacs/init-rainbow-delimiters ()
(add-hook 'erlang-mode-hook 'turn-on-rainbow-delimiters-mode))
(defun spacemacs/init-ruby-end ()
(use-package ruby-end
:defer t
:config (spacemacs//hide-lighter ruby-end-mode)))
(defun spacemacs/init-smartparens ()
(add-hook 'erlang-mode-hook 'smartparens-mode))
(defun spacemacs/init-yasnippet ()
(add-hook 'erlang-mode-hook 'spacemacs/load-yasnippet))

View file

@ -17,12 +17,8 @@
dash
diminish
dired+
edts
elisp-slime-nav
elixir-mix
elixir-mode
ensime
erlang
evil
evil-args
evil-escape
@ -234,8 +230,7 @@ which require an initialization must be listed explicitly in the list.")
:commands global-auto-complete-mode
:init
(add-to-hooks 'auto-complete-mode '(org-mode-hook
prog-mode-hook
erlang-mode-hook))
prog-mode-hook))
:idle (global-auto-complete-mode)
:idle-priority 1
:config
@ -292,8 +287,7 @@ which require an initialization must be listed explicitly in the list.")
(use-package auto-highlight-symbol
:commands auto-highlight-symbol-mode
:init
(add-to-hooks 'auto-highlight-symbol-mode '(erlang-mode-hook
prog-mode-hook
(add-to-hooks 'auto-highlight-symbol-mode '(prog-mode-hook
org-mode-hook
markdown-mode-hook))
:config
@ -467,67 +461,10 @@ which require an initialization must be listed explicitly in the list.")
:config
(add-hook 'emacs-lisp-mode-hook (lambda () (elisp-slime-nav-mode t)))))
(defun spacemacs/init-elixir-mix ()
(use-package elixir-mix
:defer t
:init
(global-elixir-mix-mode)))
(defun spacemacs/init-elixir-mode ()
(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))))))
(defun spacemacs/init-ensime ()
(use-package ensime
:defer t))
(defun spacemacs/init-erlang ()
(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"))
))
(unless (eq window-system 'w32)
(require 'edts-start))
;; (setq edts-log-level 'debug)
;; (setq edts-face-inhibit-mode-line-updates t)
(evil-leader/set-key-for-mode 'erlang-mode
"md" 'edts-find-doc
"me" 'edts-code-next-issue
"mG" 'edts-find-global-function
"mg" 'edts-find-source-under-point
"mh" 'edts-find-header-source
"ml" 'edts-find-local-function
"mm" 'edts-find-macro-source
"mr" 'edts-find-record-source)))
;; not needed using EDTS
;; (require 'erlang-flymake)
;; (erlang-flymake-only-on-save)
)
(defun spacemacs/init-evil ()
(use-package evil
:init
@ -936,7 +873,6 @@ determine the state to enable when escaping from the insert state.")
(progn
(dolist (mode '(c
coffee
elixir
js
json
ruby
@ -1056,8 +992,7 @@ determine the state to enable when escaping from the insert state.")
(use-package git-gutter-fringe
:commands git-gutter-mode
:init
(add-to-hooks 'git-gutter-mode '(erlang-mode-hook
markdown-mode-hook
(add-to-hooks 'git-gutter-mode '(markdown-mode-hook
org-mode-hook
prog-mode-hook
))
@ -1947,9 +1882,7 @@ determine the state to enable when escaping from the insert state.")
(interactive)
(rainbow-delimiters-mode 1))
(add-to-hooks
'turn-on-rainbow-delimiters-mode '(prog-mode-hook
erlang-mode-hook
)))))
'turn-on-rainbow-delimiters-mode '(prog-mode-hook)))))
(defun spacemacs/init-rainbow-mode ()
(use-package rainbow-mode
@ -2007,11 +1940,6 @@ determine the state to enable when escaping from the insert state.")
(use-package rfringe
:defer t))
(defun spacemacs/init-ruby-end ()
(use-package ruby-end
:defer t
:config (spacemacs//hide-lighter ruby-end-mode)))
(defun spacemacs/init-ruby-mode ()
(use-package ruby-mode
:defer t
@ -2028,8 +1956,7 @@ determine the state to enable when escaping from the insert state.")
:defer t
:init
(progn
(add-to-hooks 'smartparens-mode '(erlang-mode-hook
markdown-mode-hook
(add-to-hooks 'smartparens-mode '(markdown-mode-hook
prog-mode-hook)))
:config
(progn
@ -2181,8 +2108,7 @@ determine the state to enable when escaping from the insert state.")
(setq yas-snippet-dirs yas-dir)
(yas-global-mode 1)))))
(add-to-hooks 'spacemacs/load-yasnippet '(prog-mode-hook
org-mode-hook
erlang-mode-hook)))
org-mode-hook)))
:config
(progn
(spacemacs//diminish yas-minor-mode "")