Indentation in Java mode

Java mode seems to be non-intensive, not indented after a method declaration.

By this, I mean I expect to see this:

class GoodExample {
    public void method() {
        allNicelyIndented();
        noProblemsHere();
    }
}

But instead, we get the following:

class CrazyIndenting {
    public void method() {  // ((inclass 134) (topmost-intro 326))
  whyIsThisUnindented();    // ((defun-block-intro 379))
  itsMessingWithMyHead();   // ((statement 454))
    }
}

M-x c-set-style RET javaand then C-x h C-M-\confirms that it uses the java style for the whole buffer.

Using cc-modes is an interactive function , C-c C-sgives the characters that I added in the comments after the incorrectly formatted code, and C-c C-ooffers default values ​​that look reasonable. (0, + and 0 in descending order)

.emacs, , cc-mode, . Unindent , (2 "" 4), , , ?

: Emacs 22.2.1, JDE 2.3.5.1 CC-mode 5.31.5.

+3
1

, JDEE, malabar-mode. Java- Emacs, ( maven groovy) ...

- , Java JDEE ( java-), , , ( cc-mode, , ).

+2

Source: https://habr.com/ru/post/1750842/


All Articles