Permalink
Browse files

Merge pull request #364 from elixir-lang/fix-hang-after-do

Fix issue that emacs hangs after def? statements
  • Loading branch information...
2 parents fe313d3 + 7bd2619 commit 8e77a8410cb0d7e05530d46d17569ad20baf8e49 @tonini tonini committed Jun 7, 2016
Showing with 12 additions and 43 deletions.
  1. +2 −7 elixir-smie.el
  2. +10 −36 test/elixir-mode-indentation-test.el
View
@@ -115,12 +115,7 @@
'((id)
(statements (statement)
(statement ";" statements))
- (statement ("def" non-block-expr "do" statements "end")
- ("defp" non-block-expr "do" statements "end")
- ("defp" non-block-expr "COMMA" "do:" non-block-expr)
- ("defmacro" non-block-expr "do" statements "end")
- ("defmacrop" non-block-expr "do" statements "end")
- (non-block-expr "fn" match-statements "end")
+ (statement (non-block-expr "fn" match-statements "end")
(non-block-expr "do" statements "end")
("if" non-block-expr "do" statements "else" statements "end")
("if" non-block-expr "do" statements "end")
@@ -312,7 +307,7 @@
(elixir-smie--implicit-semi-p))
(if (elixir-smie--semi-ends-match)
"MATCH-STATEMENT-DELIMITER"
- (if (and (looking-back ",$" (- (point) 2) t)
+ (if (and (looking-back ",$" (- (point) 3) t)
(not (> (nth 0 (syntax-ppss)) 0)))
"COMMA"
";")))
@@ -1013,14 +1013,14 @@ end
(:tags '(indentation))
"
def foo do
- case is_string(x) do
- true ->
- x2 = \" one\"
- x <> x2
- false ->
- x2 = \" two\"
- x <> x2
- end
+case is_string(x) do
+true ->
+x2 = \" one\"
+x <> x2
+false ->
+x2 = \" two\"
+x <> x2
+end
end"
"
def foo do
@@ -1566,30 +1566,6 @@ defmodule Foo do
end
")
-(elixir-def-indentation-test complex-case-with-matches
- (:tags '(indentation))
-"
-case parse do
-{ [ help: true ], _, _ }
- -> :help
-{ _, [ user, project, count ], _ } ->
-{ user, project, count }
- { _, [ user, project ], _ } -> { user, project, @default_count }
-{ _, [ _, project ], _ } -> { _, project, @default_count }
-_ -> :help
-end"
-"
-case parse do
- { [ help: true ], _, _ }
- -> :help
- { _, [ user, project, count ], _ } ->
- { user, project, count }
- { _, [ user, project ], _ } -> { user, project, @default_count }
- { _, [ _, project ], _ } -> { _, project, @default_count }
- _ -> :help
-end")
-
-
(elixir-def-indentation-test complex-case-with-matches/2
(:tags '(indentation))
"
@@ -1685,16 +1661,14 @@ end
"case statement do
%{\"foo\" => \"foo\",
\"baz\" => \"baz\"} ->
- :ok
-
- _ ->
+:ok
+_ ->
:ok
end"
"case statement do
%{\"foo\" => \"foo\",
\"baz\" => \"baz\"} ->
:ok
-
_ ->
:ok
end")

0 comments on commit 8e77a84

Please sign in to comment.