Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The main difference I found between Eclipse (and IntelliJ) and Emacs default java formatting is that Emacs lines up function arguments continued onto a new line with the previous arguments e.g. emacs does:</p> <pre><code>BigLongJavaStuff.doFoobarToQuux("argument 1", "argument 2"); </code></pre> <p>and Eclipse does:</p> <pre><code>BigLongJavaStuff.doFoobarToQuux("argument 1", "argument 2"); </code></pre> <p>The following added to you ~/.emacs file will make Emacs java-mode do the same:</p> <pre><code>;; 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")))) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload