So emacs's java-mode
handles indenting continued method invocations at the function body level out of the box, but it doesn't seem to handle them inside of an argument list. I'd like to override this behavior. I'm aware of C-c C-s
, but in this particular example both the line that begins with Other
and the line that begins with .newBuilder()
are arglist-cont
. I'd like to distinguish between these two cases. In the function-level example .newBuilder()
is statement-cont
, so that's why it's getting indented correctly. (I just realized that I do actually have (arglist-intro . +)
set in my current style so that is why args[0]
is getting indented once instead of aligning to the preceding parenthesis, but even without that setting, the .newBuilder()
line still aligns with the other arguments instead of indenting one additional level.)
public class Foo {
void main(String[] args) {
/* This works just fine */
Other
.newBuilder()
.fluent1()
.fluent2()
.build();
/* This is how it works currently. */
someMethodThatTakesOther(
args[0],
args[1],
Other
.newBuilder()
.fluent1()
.fluent2()
.build());
/* This is what I would like. */
someMethodThatTakesOther(
args[0],
args[1],
Other
.newBuilder()
.fluent1()
.fluent2()
.build());
}
}