From 8c0a4cfbeffc8037ed72c70b7cb91f1d591719fd Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 27 Mar 2018 19:42:56 -0400 Subject: [PATCH] lang/elixir: refactor smartparens+use-package config --- modules/lang/elixir/config.el | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/lang/elixir/config.el b/modules/lang/elixir/config.el index d07bfd3a5..5ce920e70 100644 --- a/modules/lang/elixir/config.el +++ b/modules/lang/elixir/config.el @@ -5,17 +5,19 @@ :mode "\\.elixir2$" :config ;; disable standard config; more disruptive than it needs to be - (dolist (beg '("fn" "do" "def" "defp" "defmodule" "if" "unless" "case" "receive")) - (sp-local-pair 'elixir-mode beg nil :actions :rem)) + (map-delete sp-pairs 'elixir-mode) ;; only complete the basics (sp-with-modes 'elixir-mode - (sp-local-pair "do" "end" :when '(("RET" "")) :post-handlers '("||\n[i]")) - (sp-local-pair "do " " end") - (sp-local-pair "fn " " end"))) + (sp-local-pair "do" "end" + :when '(("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)))) (def-package! alchemist - :after elixir-mode :hook (elixir-mode . alchemist-mode) :config (set! :lookup 'elixir-mode