diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index 0837cf2a1..3693be711 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -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 0 | execute action 9 a | toggle action selection menu -### Erlang - -`Spacemacs` uses [EDTS][edts] as an Erlang coding environment. - - Key Binding | Description -----------------------|------------------------------------------------------------ -SPC m d | show man page documentation -SPC m e | go to next issue -SPC m g | go to definition -SPC m G | find a module in the current project -SPC m h | open the header file under point -SPC m l | find a function in the current module -SPC m m | go to the macro definition under point -SPC m r | go to the record definition under point - ### Ledger Key Binding | Description diff --git a/contrib/lang/erlang-elixir/README.md b/contrib/lang/erlang-elixir/README.md new file mode 100644 index 000000000..b01e27da2 --- /dev/null +++ b/contrib/lang/erlang-elixir/README.md @@ -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 +--------------------|------------------------------------------------------------ +SPC m d | show man page documentation +SPC m e | go to next issue +SPC m g | go to definition +SPC m G | find a module in the current project +SPC m h | open the header file under point +SPC m l | find a function in the current module +SPC m m | go to the macro definition under point +SPC m r | go to the record definition under point + diff --git a/contrib/lang/erlang-elixir/packages.el b/contrib/lang/erlang-elixir/packages.el new file mode 100644 index 000000000..ee4eeee94 --- /dev/null +++ b/contrib/lang/erlang-elixir/packages.el @@ -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)) diff --git a/spacemacs/packages.el b/spacemacs/packages.el index b092bb9d3..b5ed8058e 100644 --- a/spacemacs/packages.el +++ b/spacemacs/packages.el @@ -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 " Ⓨ")