When I use emacs python-mode, if the last character of a line is an open parenthesis it indents the next line just one step in from the indentation of the previous line.
call_some_function(
some_very_long_argument_that_I_want_to_put_on_its_own_line)
I like that. Now in ecmascript-mode (which I am using for actionscript 3), it always indents to the level of the previous parenthesis.
call_some_function(
this_is_not_really_saving_me_any_horizontal_space);
How can I make ecmascript-mode indent like python-mode in this respect?
Since ecmascript-mode is based on cc-mode, you can use
c-set-offset
which allows you to customize any syntactic symbol's offset with the preferred value.In your case, go to the point which is indented in the wrong level, hit
C-c C-o
(or typeM-x c-set-offset
), accept the suggested symbol (arglist-intro
), and set it a new value (e.g.+
, the default offset).You can also do it programmatically in your dotemacs, for instance, with:
ecmascript-mode seems to be based on cc-mode. If you set the indentation style for cc-mode, it will also work for ecmascript-mode. I have the following code in my .emacs. When I use ecmascript-mode it indents as desired:
Thank you Török Gábor, in my case I prefered to set
I was looking for something like this :
veryLongFunctionName (bar, bar, bar)
For a more exhaustive list of variables : read emacs documentation