Emacs change list auto indenting

243 views Asked by At

I love Emacs' auto indentation, however I have one issue with it (in every major mode I've tried) and that is auto indenting lists.

This is how all major modes I've used so far indent lists:

pseudo code:

variableFoo = [
               valueOne,
               valueTwo,
               valueThree
              ]

However, this is what I actually want:

variableFoo = [
    valueOne,
    valueTwo,
    valueThree
]

So instead of having the values 1 space farther than the opening bracket, I want them to be 4 spaces farther than the variable definition. Or it can be seen as since it's 1 level deeper (in a list) and should have 1 indentation of 4 spaces. Lastly the closing bracket should be on the same column as the variable definition.

I would assume that the indentation is defined inside the major mode (be it Ruby, Haskell, Erlang, C, etc) But maybe there's a way to adjust the auto indentation that it would work this way by default?

Thanks in advance

Edit:

So I've found the solution for Ruby which is simply adding:

(setq ruby-deep-indent-paren nil)

To your emacs file. However this only works for Ruby and doesn't solve the problem for Haskell / Erlang / Elixir

0

There are 0 answers