Till yesterday, I was a happy user of out-of-the-box emacs + erlang-mode. Then my colleague started contributing to the project (using some windows editor), and it seems he is not very happy with the mixed indent mode used by default by erlang-mode. Here is an example. This a part of a function, written using auto-indent on erlang-mode
handle_info(get_gss_latest_versions, State) ->
GetReqIds = fun(Branch) ->
GetInfoUri = State#state.gss_uri ++ Branch ++ "/api/getinfo",
case ibrowse:send_req(GetInfoUri, [], get, [], [{stream_to, self()}]) of
{ibrowse_req_id, ReqId} ->
{ReqId, Branch};
{error, Reason} ->
If you take a closer look, you'll see that line 2 (starting with GetReqIds) is indented with 4 spaces. Line 3 is indented with 3 tabs. Line 5 is indented with 3 tabs + 4 spaces. Line 6 is indented with 4 tabs. As a result, most (dumb) editors (unlike emacs) display lines 5 and 6 (the ones starting with {ibrowse and {ReqId) at the same indentation level. Which looks ugly. (even stackoverflow shows them that way).
I had a look at several prominent erlang softwares (like gproc) and most of them seem to use spaces-only indentation mode.
So my questions are:
This seems to be the right solution for me, right at the moment (put in ~/.emacs) :
(add-hook 'erlang-mode-hook '(lambda() (setq indent-tabs-mode nil)))
I shamelessly copied it from here: http://erlang.2086793.n4.nabble.com/erlang-mode-emacs-tabs-vs-spaces-td2096289.html
To generally disable tabs in indention, not only, but also for erlang-mode, use:
(set-default 'indent-tabs-mode nil)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With