Skip to content

Commit

Permalink
Merge pull request #316 from elixir-lang/correct-if-indention-inside-…
Browse files Browse the repository at this point in the history
…else-block

Fix indentation of if within an else block
  • Loading branch information
tonini committed Mar 24, 2016
2 parents c056282 + b56362f commit e909185
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 10 additions & 2 deletions elixir-smie.el
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,16 @@
;; ....
((elixir-smie-last-line-end-with-block-operator-p)
(smie-rule-parent elixir-smie-indent-basic))
(t
(smie-rule-parent))))
;; Indent if inside else
;;
;; Example:
;;
;; else
;; if condition, do: :bar <-
;; end
((smie-rule-parent-p "else")
(smie-rule-parent elixir-smie-indent-basic))
(t (smie-rule-parent))))
(`(:before . "->")
(cond
;; Example
Expand Down
3 changes: 1 addition & 2 deletions test/elixir-mode-indentation-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,7 @@ end")


(elixir-def-indentation-test indent-if-else/2
;; https://github.com/elixir-lang/emacs-elixir/issues/288
(:expected-result :failed :tags '(indentation))
(:tags '(indentation))
"
if condition do
:foo
Expand Down

0 comments on commit e909185

Please sign in to comment.