开发者

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

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:

(custo开发者_StackOverflow中文版m-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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜