Currently my team (non-Emacs users) indent java like so:
public DiskThresholdDecider(Settings settings,
NodeSettingsService nodeSettingsService,
ClusterInfoService infoService,
Client client) {
String lowWatermark = settings.get(CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK,
"85%");
There are two different indentation settings for the same c-style offset, for example (|
denotes the cursor):
public DiskThresholdDecider(Settings settings,
|NodeSettingsService nodeSettingsService,
ClusterInfoService infoService,
Client client) {
C-c C-s
(c-show-syntactic-information) returns (arglist-cont-nonempty ... ...)
Just a couple of lines down, on the method invocation, C-c C-s
also returns (arglist-cont-nonempty ... ...)
here:
String lowWatermark = settings.get(CLUSTER_ROUTING_ALLOCATION_LOW_DISK_WATERMARK,
|"85%");
In my configuration, I have this set up as:
(defconst intellij-java-style
'((c-basic-offset . 4)
(c-comment-only-line-offset . (0 . 0))
(c-offsets-alist
.
((inline-open . 0)
(topmost-intro-cont . +)
(statement-block-intro . +)
(knr-argdecl-intro . +)
(substatement-open . +)
(substatement-label . +)
(case-label . +)
(label . +)
(statement-case-open . +)
(statement-cont . ++)
(arglist-intro . 0)
(arglist-cont-nonempty . ++) ;; <-- the actual setting
(arglist-close . --)
(inexpr-class . 0)
(access-label . 0)
(inher-intro . ++)
(inher-cont . ++)
(brace-list-intro . +)
(func-decl-cont . ++))))
"Elasticsearch's Intellij Java Programming Style")
The problem is I need Emacs to treat class constructors as different indentation style than regular method invocations. This is so it will line up lines on the (
only for constructors.
Is there a function I can use to set for arglist-cont-nonempty
that will indent this correctly or a way to do this?