Emacs enum indentation

Posted by Masterofpsi on Stack Overflow See other posts from Stack Overflow or by Masterofpsi
Published on 2010-04-30T18:34:49Z Indexed on 2010/04/30 18:37 UTC
Read the original article Hit count: 330

Filed under:
|
|
|

I'm having a problem with Emacs's indentation of Java enums. While it indents the first member OK, it wants to give all of the rest of the static enum members an additional level of indentation. It looks like this:

class MyClass {
    public enum MyEnum {
        ONE(1), //good
            TWO(2), // not good!
            THREE(3),
            FOUR(4);
        private final int value;
    }
}

When I run C-c C-s on the line that opens the enum, it gives me ((inclass 1) (topmost-intro 1)), which doesn't seem quite right -- it seems like it should be giving brace-list-open. When I run it on the first enum member, it gives me ((defun-block-intro 21)), which is definitely not right. Every subsequent member gives (statement-cont 50).

I'm in java-mode and I'm using the java style of indentation. Does anyone know what the problem might be?

© Stack Overflow or respective owner

Related posts about emacs

Related posts about indentation