简体   繁体   中英

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:

(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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM