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
|
|
|
|
;; disable default smartparens config
|
|
|
|
(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
|
2018-05-25 00:46:11 +02:00
|
|
|
(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))
|
2018-06-15 02:58:12 +02:00
|
|
|
(sp-local-pair "fn " " end" :unless '(sp-in-comment-p sp-in-string-p))))
|
|
|
|
|
|
|
|
(def-package! alchemist-company
|
|
|
|
:when (featurep! :completion company)
|
|
|
|
:commands alchemist-company
|
|
|
|
:init
|
|
|
|
(set-company-backend! 'elixir-mode '(alchemist-company company-yasnippet))
|
|
|
|
:config
|
|
|
|
;; Alchemist doesn't use hook symbols to add these backends, so we have to use
|
|
|
|
;; the entire closure to get rid of it.
|
|
|
|
(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-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))
|
2017-12-18 13:12:48 -05:00
|
|
|
|