Eclipse(とIntelliJ)とEmacsのデフォルトのJava書式設定の主な違いは、Emacsが関数引数を前の引数で改行したことです。 Emacsはありません:
BigLongJavaStuff.doFoobarToQuux("argument 1",
"argument 2");
とEclipseを行います
BigLongJavaStuff.doFoobarToQuux("argument 1",
"argument 2");
あなたに追加された次の〜/の.emacsファイルが作成されますEmacsのjavaのモードは、同じ操作を行います。
;; eclipse-java-style is the same as the "java" style (copied from
;; cc-styles.el) with the addition of (arglist-cont-nonempty . ++) to
;; c-offsets-alist to make it more like default Eclipse formatting -- function
;; arguments starting on a new line are indented by 8 characters
;; (++ = 2 x normal offset) rather than lined up with the arguments on the
;; previous line
(defconst eclipse-java-style
'((c-basic-offset . 4)
(c-comment-only-line-offset . (0 . 0))
;; the following preserves Javadoc starter lines
(c-offsets-alist . ((inline-open . 0)
(topmost-intro-cont . +)
(statement-block-intro . +)
(knr-argdecl-intro . 5)
(substatement-open . +)
(substatement-label . +)
(label . +)
(statement-case-open . +)
(statement-cont . +)
(arglist-intro . c-lineup-arglist-intro-after-paren)
(arglist-close . c-lineup-arglist)
(access-label . 0)
(inher-cont . c-lineup-java-inher)
(func-decl-cont . c-lineup-java-throws)
(arglist-cont-nonempty . ++)
)))
"Eclipse Java Programming Style")
(c-add-style "ECLIPSE" eclipse-java-style)
(customize-set-variable 'c-default-style (quote ((java-mode . "eclipse") (awk-mode . "awk") (other . "gnu"))))
うん、このEclipseの字下げ(または少なくともそれが使用しているスタイル)の特徴のために避けようとしていたものです。私は誰かがすでに私がちょうどドロップできるEclipseスタイルをプログラムしていたことを期待していました。 – user98166
あなたがこれまでにやったことがあれば - あなたは連想メートを公開できますか?ここでもできる? – Arkadiy
良い、簡単なスタートについてはhttp://stackoverflow.com/questions/5556558/getting-consistent-indentation-in-eclipse-and-emacsを参照してください。 Arkadiyが言ったように、誰かがこれを釘付けすれば、投稿してください! –