Question

When writing Scala code in Emacs, I notice the following indentation issue:

List(1,2,3).foreach{ x =>

Then press enter.

Then close the bracket, and this is what ends up happening:

List(1,2,3).foreach{ x =>
                  }

Although this is one particular example, this issue appears in a variety of ways when auto-indenting in Emacs.

An answer to either of these two questions would be appreciated:

  1. How can this issue be fixed so that the brace gets put in the proper place and anything within the braces is indented one level to the right?

  2. Is it possible to disable this type of auto-indentation (i.e. like 'set noautoindent' in vi). I tried solutions like the ones suggested here: Disable auto indent globally in Emacs without success.

Thanks in advance!

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top