Emacs Erlang mode indenting twice what erlang-indent-level specifies

1.1k views Asked by At

Emacs is indenting my Erlang twice as much as I think I'm telling it to.

If I set erlang-indent-level to 2, it indents to 4:

fun(Keys, Values, ReReduce) ->
    lists:sum(Values)
end.

If I set erlang-indent-level to 4, it indents to 8:

fun(Keys, Values, ReReduce) ->
        lists:sum(Values)
end

I've verified, using "od -c", that there are no tab characters in my Erlang files.

Why is the indentation level twice what erlang-indent-level is set to?


The parts of my .emacs having to do with indentation:

(custom-set-variables
 '(indent-tabs-mode nil)
 ...

; Set to 2 in order to get 4
(setq erlang-indent-level 2)

Versions:

  • GNU Emacs 23.2.1
  • erlang.el from Debian package "erlang-mode" version 1:14.a-dfsg-3
1

There are 1 answers

9
Lindydancer On BEST ANSWER

It's because "fun" is a special keyword. If you name your function to something else, it will indent the function as you expect.