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
|
2018-05-25 00:46:11 +02:00
|
|
|
:defer t
|
2018-06-25 15:54:38 +02:00
|
|
|
:init
|
2019-03-02 01:56:32 -05:00
|
|
|
;; Disable default smartparens config. There are too many pairs; we only want
|
|
|
|
;; a subset of them (defined below).
|
2018-06-25 15:54:38 +02:00
|
|
|
(provide 'smartparens-elixir)
|
2017-05-24 13:08:26 +03:00
|
|
|
:config
|
2018-12-06 17:00:24 +11:00
|
|
|
(set-pretty-symbols! 'elixir-mode
|
|
|
|
;; Functional
|
|
|
|
:def "def"
|
|
|
|
:lambda "fn"
|
2018-12-06 17:09:00 +11:00
|
|
|
;; :src_block "do"
|
|
|
|
;; :src_block_end "end"
|
2018-12-06 17:00:24 +11:00
|
|
|
;; Flow
|
|
|
|
:not "!"
|
|
|
|
:in "in" :not-in "not in"
|
|
|
|
:and "and" :or "or"
|
|
|
|
:for "for"
|
|
|
|
:return "return" :yield "use")
|
2018-06-15 02:58:12 +02:00
|
|
|
|
2019-03-02 01:56:32 -05:00
|
|
|
;; ...and only complete the basics
|
|
|
|
(after! smartparens
|
|
|
|
(sp-with-modes 'elixir-mode
|
|
|
|
(sp-local-pair "do" "end"
|
|
|
|
:when '(("RET" "<evil-ret>"))
|
|
|
|
:unless '(sp-in-comment-p sp-in-string-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))))
|
|
|
|
|
2018-06-15 02:58:12 +02:00
|
|
|
(def-package! alchemist-company
|
|
|
|
:when (featurep! :completion company)
|
|
|
|
:commands alchemist-company
|
|
|
|
:init
|
|
|
|
(set-company-backend! 'elixir-mode '(alchemist-company company-yasnippet))
|
|
|
|
:config
|
2018-09-02 17:18:31 +02:00
|
|
|
;; Alchemist doesn't use hook symbols to add these backends, so we have to
|
|
|
|
;; use the entire closure to get rid of it.
|
2018-06-15 02:58:12 +02:00
|
|
|
(let ((fn (byte-compile (lambda () (add-to-list (make-local-variable 'company-backends) 'alchemist-company)))))
|
|
|
|
(remove-hook 'alchemist-mode-hook fn)
|
2018-09-01 16:17:52 +02:00
|
|
|
(remove-hook 'alchemist-iex-mode-hook fn)))
|
|
|
|
|
|
|
|
(def-package! flycheck-credo
|
2019-02-22 00:20:29 -05:00
|
|
|
:when (featurep! :tools flycheck)
|
2018-09-01 16:17:52 +02:00
|
|
|
:config (flycheck-credo-setup)))
|
2017-12-18 13:12:48 -05:00
|
|
|
|
|
|
|
|
|
|
|
(def-package! alchemist
|
|
|
|
:hook (elixir-mode . alchemist-mode)
|
|
|
|
:config
|
2018-06-15 17:27:48 +02:00
|
|
|
(set-lookup-handlers! 'elixir-mode
|
2017-12-18 13:12:48 -05:00
|
|
|
:definition #'alchemist-goto-definition-at-point
|
|
|
|
:documentation #'alchemist-help-search-at-point)
|
2018-06-15 16:07:24 +02:00
|
|
|
(set-eval-handler! 'elixir-mode #'alchemist-eval-region)
|
|
|
|
(set-repl-handler! 'elixir-mode #'alchemist-iex-project-run))
|