From a0bee9348639db9750171a42262161cd2f0aa30b Mon Sep 17 00:00:00 2001 From: Matt DeBoard Date: Sun, 22 Jun 2014 21:32:18 -0400 Subject: [PATCH] Remove grammar clause for "fn" terminal. Fixes #7 After stepping through SMIE functions with EDebug, I realized the only actual problem in indenting blocks like these is that for the sake of the grammar, `fn` is considered an opener. I tried many ways to get this particular issue sorted out, but the simplest was just to remove that clause from the grammar. --- elixir-smie.el | 1 - test/elixir-mode-indentation-tests.el | 8 +++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/elixir-smie.el b/elixir-smie.el index e1d75bc2..828c2a45 100644 --- a/elixir-smie.el +++ b/elixir-smie.el @@ -240,7 +240,6 @@ Return non-nil if any line breaks were skipped." ("try" "do" statements "catch" match-statements "end") ("try" "do" statements "end") ("case" non-block-expr "do" match-statements "end") - ("fn" match-statement "end") ("function" "do" match-statements "end") (non-block-expr "do" statements "end") (expr) diff --git a/test/elixir-mode-indentation-tests.el b/test/elixir-mode-indentation-tests.el index d87a6127..ef5c75d5 100644 --- a/test/elixir-mode-indentation-tests.el +++ b/test/elixir-mode-indentation-tests.el @@ -248,8 +248,7 @@ function do end ") -(elixir-def-indentation-test indents-fn-in-assignment - (:expected-result :failed) +(elixir-def-indentation-test indents-fn-in-assignment () " f = fn x, y -> x + y @@ -259,11 +258,10 @@ f = fn x, y -> x + y end") -(elixir-def-indentation-test indents-fn-as-arguments - (:expected-result :failed) +(elixir-def-indentation-test indents-fn-as-arguments () " Enum.map 1..10, fn x -> -x+1 +x + 1 end" " Enum.map 1..10, fn x ->