Emacs Erlang mode

Olivier Boudeville olivier.boudeville@REDACTED
Sun Jan 31 21:49:04 CET 2010


Hello,

With Emacs, when using the erlang.el file (from R13B03), indenting 
apparently results in aligning the first parameter of a function, if 
that parameter has been put on next line, with a 2-character offset 
compared to the beginning of the function name, like in: (use fixed 
width characters to view the snippet layout correctly)

"""
get_textual_duration(FirstTimestamp,SecondTimestamp) ->
    {Days,{Hour, Minute, Second}} = calendar:seconds_to_daystime(
                                      get_duration( FirstTimestamp,
                                                    SecondTimestamp) ),

"""


It leads, when using long variable names and respecting a max line width 
of, say, 80 characters, to a kind of piling in the rightmost part of the 
text.

I know that these must be OTP formatting rules, but, for the ones that 
would prefer another layout, would there be a simple tweak to erlang.el 
so that the 2-character offset is applied to the indentation level of 
the previous line instead, like in:
"""
get_textual_duration(FirstTimestamp,SecondTimestamp) ->

    {Days,{Hour, Minute, Second}} = calendar:seconds_to_daystime(
      get_duration( FirstTimestamp, SecondTimestamp) ),
"""
(i.e. like when using "(arglist-intro . 2)" in emacs cc-mode)

Similarly, if a first parameter is specified and a new line is added, 
currently next parameter will be put just below it (ex: see 
SecondTimestamp in the original example), whereas one may prefer that 
again a 2-character offset is applied to the indentation level of the 
previous line instead, resulting in a more compact statement (it would 
be "(arglist-cont-nonempty . 2)" in emacs cc-mode)

I suspect that the solution would lie, in erlang.el, in the 
erlang-calculate-stack-indent function but it exceeds my elisp knowledge.

Any idea?

I am reluctant either to define in functions too many intermediate 
variables that would be used only once, or to shorten my variable names, 
because I think it would obfuscate the code.

Thanks in advance for any information,
Best regards,

Olivier.




More information about the erlang-questions mailing list