3

I use Emacs for Android development and this has been bugging me lately.

I'm trying to get the following indentation behaviour:

submitBtn.setOnClickListener(new OnClickListener() {
  @Override
  public void onClick(View v) {
    submitEnquiry();
  }
});

and with my current setup I'm getting this:

submitBtn.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
      submitEnquiry();
    }
  });

Quite a specific case I know, but one that I'm running into very often. I'm using Emacs 24.4 and I'm only modifying c-basic-offset in my java-mode-hook at the moment.

itsjeyd
  • 14,586
  • 3
  • 58
  • 87
sjm
  • 71
  • 4

1 Answers1

4

After some poking around, it looks like this has fixed it (getting called in java-mode-hook):

(c-set-offset 'inexpr-class 0)

By default it is set to +. inexpr-class controls the indentation level for anonymous classes and anonymous initialisation.

itsjeyd
  • 14,586
  • 3
  • 58
  • 87
sjm
  • 71
  • 4