Skip to content

Commit

Permalink
[Fix #877] Do not pair do in elixir strings/comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuco1 committed Mar 25, 2018
1 parent bf7bf7c commit 6eea872
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion smartparens-elixir.el
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ ID, ACTION, CONTEXT."
(sp-with-modes 'elixir-mode
(sp-local-pair "do" "end"
:when '(("SPC" "RET" "<evil-ret>"))
:skip-match 'sp-elixir-skip-def-p)
:skip-match 'sp-elixir-skip-def-p
:unless '(sp-in-comment-p sp-in-string-p))
(sp-local-pair "def" "end"
:when '(("SPC" "RET" "<evil-ret>"))
:post-handlers '(sp-elixir-do-block-post-handler)
Expand Down
3 changes: 3 additions & 0 deletions test/smartparens-elixir-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ end"))
(ert-deftest sp-test-elixir-if-block-insertion-in-string ()
(sp-test-insertion-elixir "\"a string |" "if " "\"a string if |"))

(ert-deftest sp-test-elixir-do-block-insertion-in-string ()
(sp-test-insertion-elixir "\"a string |" "do " "\"a string do |"))

(ert-deftest sp-test-elixir-forward-slurp ()
"Ensure that commas are handled properly when slurping forward"
(sp-test-with-temp-buffer "[1, [|2], :a]"
Expand Down

0 comments on commit 6eea872

Please sign in to comment.