2017-06-08 11:47:56 +02:00
|
|
|
;;; lang/elixir/config.el -*- lexical-binding: t; -*-
|
2017-05-24 13:08:26 +03:00
|
|
|
|
|
|
|
(def-package! elixir-mode
|
2017-06-28 01:32:14 -05:00
|
|
|
:mode "\\.exs?$"
|
2017-12-18 13:12:48 -05:00
|
|
|
:mode "\\.elixir2$"
|
2018-04-18 18:29:48 -04:00
|
|
|
:init
|
|
|
|
;; sp's default elixir rules are obnoxious, so disable them
|
|
|
|
(provide 'smartparens-elixir)
|
2017-05-24 13:08:26 +03:00
|
|
|
:config
|
2018-04-18 18:29:48 -04:00
|
|
|
;; ...and only complete the basics
|
2017-12-18 13:12:48 -05:00
|
|
|
(sp-with-modes 'elixir-mode
|
2018-03-27 19:42:56 -04:00
|
|
|
(sp-local-pair "do" "end"
|
|
|
|
:when '(("RET" "<evil-ret>"))
|
|
|
|
:unless '(sp-in-comment-p sp-in-string-p)
|
|
|
|
:skip-match 'sp-elixir-skip-def-p
|
|
|
|
:post-handlers '("||\n[i]"))
|
|
|
|
(sp-local-pair "do " " end" :unless '(sp-in-comment-p sp-in-string-p))
|
|
|
|
(sp-local-pair "fn " " end" :unless '(sp-in-comment-p sp-in-string-p))))
|
2017-12-18 13:12:48 -05:00
|
|
|
|
|
|
|
|
|
|
|
(def-package! alchemist
|
|
|
|
:hook (elixir-mode . alchemist-mode)
|
|
|
|
:config
|
2018-01-05 23:55:04 -05:00
|
|
|
(set! :lookup 'elixir-mode
|
2017-12-18 13:12:48 -05:00
|
|
|
:definition #'alchemist-goto-definition-at-point
|
|
|
|
:documentation #'alchemist-help-search-at-point)
|
2018-03-26 19:46:47 +02:00
|
|
|
(set! :eval 'elixir-mode #'alchemist-eval-region)
|
|
|
|
(set! :repl 'elixir-mode #'alchemist-iex-project-run))
|
2017-12-18 13:12:48 -05:00
|
|
|
|
|
|
|
|
|
|
|
(def-package! alchemist-company
|
|
|
|
:when (featurep! :completion company)
|
2017-12-18 13:13:49 -05:00
|
|
|
:after elixir-mode
|
2017-12-18 13:12:48 -05:00
|
|
|
:config
|
|
|
|
;; Let Doom handle this
|
|
|
|
(let ((fn (byte-compile (lambda () (add-to-list (make-local-variable 'company-backends) 'alchemist-company)))))
|
|
|
|
(remove-hook 'alchemist-mode-hook fn)
|
|
|
|
(remove-hook 'alchemist-iex-mode-hook fn))
|
|
|
|
|
2017-05-24 13:08:26 +03:00
|
|
|
(set! :company-backend 'elixir-mode '(alchemist-company company-yasnippet)))
|
|
|
|
|