From 7aa7587c4e5a295be0cfd96e468ce2b34079c258 Mon Sep 17 00:00:00 2001 From: Matt DeBoard Date: Sat, 16 Aug 2014 02:11:22 -0500 Subject: [PATCH 1/2] Remove all but boolean operators from grammar for indentation. --- elixir-smie.el | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/elixir-smie.el b/elixir-smie.el index b6984429..bc419522 100644 --- a/elixir-smie.el +++ b/elixir-smie.el @@ -53,14 +53,7 @@ ,regexp) (pushnew `(,',regex-name . ,(upcase (symbol-name ',name))) elixir-syntax-class-names)))) - (elixir-smie-define-regexp-opt op - "<<<" ">>>" "^^^" "~~~" "&&&" "|||" ; op3 - "===" "!==" ; comp3 - "==" "!=" "<=" ">=" ; comp2 - "<" ">" ; comp1 - "&&" "||" "<>" "++" "--" "**" "//" "::" "<-" ".." "/>" "=~" ; op2 (minus ->) - "xor" "|>" ; http://elixir-lang.org/docs/stable/Kernel.html - ) + (elixir-smie-define-regexp-opt op "&&" "||" "!") (elixir-smie-define-regexp dot "\\.") (elixir-smie-define-regexp comma ",") (elixir-smie-define-regexp -> "->") @@ -290,7 +283,6 @@ Return non-nil if any line breaks were skipped." (smie-rule-parent elixir-smie-indent-basic) elixir-smie-indent-basic))) (`(,_ . ,(or `"COMMA")) (smie-rule-separator kind)) - (`(:after . "=") elixir-smie-indent-basic) (`(:after . "end") 0) (`(:after . ,(or `"do")) elixir-smie-indent-basic) From feb3b3b6e95d68fee8f353a6560274c7264003f3 Mon Sep 17 00:00:00 2001 From: Matt DeBoard Date: Sat, 16 Aug 2014 02:14:22 -0500 Subject: [PATCH 2/2] Add test for making sure skipped lines don't cause unexpected indentation. --- test/elixir-mode-indentation-tests.el | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/test/elixir-mode-indentation-tests.el b/test/elixir-mode-indentation-tests.el index 88965142..855e9c04 100644 --- a/test/elixir-mode-indentation-tests.el +++ b/test/elixir-mode-indentation-tests.el @@ -399,3 +399,37 @@ end") " [1.2, 3.4]") + +(elixir-def-indentation-test indent-after-operator () + " +defmodule Banana do +def start do +a = \"\" <> \"?\" + +case bar do +z -> 1 +end + +case foo do +?x -> x +end + +end +end +" + " +defmodule Banana do + def start do + a = \"\" <> \"?\" + + case bar do + z -> 1 + end + + case foo do + ?x -> x + end + + end +end +")