elixir-editors / emacs-elixir

Emacs major mode for Elixir
447 stars 94 forks source link

Defined function with `when` and without parenthesis produces incorrect indentation in body #391

Open kcdragon opened 7 years ago

kcdragon commented 7 years ago

Description

When I have a defined, multi-line function and a when with multiple operators without parenthesis, the function body is not indented properly.

Example

Expected

def foo(x) when x + 1 > y do
  []
end

Actual

def foo(x) when x + 1 > y do
                    []
end

Note: This does not happen when x + 1 is wrapped in parenthesis

def foo(x) when (x + 1) > y do
  []
end

Versions

OS: Mac OSX Sierra Emacs Version: GNU Emacs 25.1.1 elixir-mode: 20170102.942

kcdragon commented 7 years ago

I created a pull request with a failing test since this was recommended in the contributing guide. See #392