From bb17fe7a3a4ba994fe62827afebfcdf9e0250ff0 Mon Sep 17 00:00:00 2001 From: Samuel Tonini Date: Tue, 4 Aug 2015 22:08:48 +0200 Subject: [PATCH] correct indentation for closing Map curly bracket fixes #223 --- elixir-smie.el | 5 ++++- test/elixir-mode-indentation-test.el | 24 ++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/elixir-smie.el b/elixir-smie.el index fb2387f0..df4e0645 100644 --- a/elixir-smie.el +++ b/elixir-smie.el @@ -377,7 +377,10 @@ (smie-rule-parent elixir-smie-indent-basic) (if (elixir-smie-last-line-start-with-block-operator-p) (smie-rule-parent -2) - (smie-rule-parent)))))) + (smie-rule-parent)))) + ((and (smie-rule-parent-p "OP") + (smie-rule-hanging-p)) + (smie-rule-parent)))) (`(:after . "{") (cond ((smie-rule-hanging-p) diff --git a/test/elixir-mode-indentation-test.el b/test/elixir-mode-indentation-test.el index ce501e1f..761685fe 100644 --- a/test/elixir-mode-indentation-test.el +++ b/test/elixir-mode-indentation-test.el @@ -1184,7 +1184,8 @@ defmodule Foo do end ") -(elixir-def-indentation-test complex-case-with-matches (:tags '(indentation)) +(elixir-def-indentation-test complex-case-with-matches + (:tags '(indentation)) " case parse do { [ help: true ], _, _ } @@ -1207,7 +1208,8 @@ case parse do end") -(elixir-def-indentation-test complex-case-with-matches/2 (:tags '(indentation)) +(elixir-def-indentation-test complex-case-with-matches/2 + (:tags '(indentation)) " case parse do { [ help: true ], _, _ } @@ -1229,6 +1231,24 @@ case parse do _ -> :help end") +(elixir-def-indentation-test close-map-curly-brackt + (:tags '(indentation)) +" +config = %{ + async_cases: [], +exclude: opts[:exclude], +include: opts[:include], + timeout: opts[:timeout], + trace: opts[:trace] + }" +" +config = %{ + async_cases: [], + exclude: opts[:exclude], + include: opts[:include], + timeout: opts[:timeout], + trace: opts[:trace] +}") ;; We don't want automatic whitespace cleanup here because of the significant ;; whitespace after `Record' above. By setting `whitespace-action' to nil,