emacs/20erlang.el
Maciej Szlosarczyk d3c2c17ff9
Improve ctags and company configuration
Set ctags command based on major mode
Set different company backends based on major mode
Completely abandon robe in favour of ctags for Ruby
Set up Erlang configuration
2019-04-08 11:23:36 +03:00

44 lines
1.5 KiB
EmacsLisp

;; Add erlang installation to load path
(setq erlang-asdf-root "/Users/maciej/.asdf/installs/erlang/21.2.6/")
(setq load-path
(cons (format "%slib/tools-3.0.2/emacs" erlang-asdf-root)
load-path))
(require 'erlang-start)
(setq erlang-root-dir erlang-asdf-root)
(setq exec-path (cons (format "%sbin" erlang-asdf-root) exec-path))
(setq erlang-man-root-dir (format "%sman" erlang-asdf-root))
;; Flycheck checker for Erlang
(flycheck-define-checker erlang-otp
"An Erlang syntax checker using the Erlang interpreter."
:command ("erlc" "-o" temporary-directory "-Wall"
"-I" "../include" "-I" "../../include"
"-I" "../../../include" source)
:error-patterns
((warning line-start (file-name) ":" line ": Warning:" (message) line-end)
(error line-start (file-name) ":" line ": " (message) line-end))
:modes (erlang-mode))
(defun activate-erlang-mode ()
"All things for Erlang."
(flycheck-select-checker 'erlang-otp)
;; Set specific ctags command
(setq-local
ctags-refresh-command
(format
"ctags -e -R --languages=erlang -f %sTAGS %s. %slib/stdlib-* %slib/kernel-*"
(projectile-project-root) (projectile-project-root)
erlang-asdf-root erlang-asdf-root)
(add-to-list (make-local-variable 'company-backends)
'(company-etags company-yasnippet))
)
;; Company list override
(add-to-list (make-local-variable 'company-backends) 'company-etags))
(add-hook 'erlang-mode-hook 'activate-erlang-mode)