Emacs-D-Mode-Maintainers / Emacs-D-Mode

An Emacs mode for D code.
GNU General Public License v3.0
84 stars 22 forks source link

This improves the indentation of else version and else debug statements, issue #39 #41

Closed dmakarov closed 9 years ago

dmakarov commented 9 years ago

With this change multiple choice version statements like the following are indented correctly

version (A)
{
}
else version (B)
{
}
else
{
}

The same works for debug statements. However, if version is not on the same line with else, the indentation of the trailing else is not correct

version (A)
{
}
else
  version (B)
  {
  }
else
{
}

Yet, I believe it's still an improvement. Please, review the PR when you have time.

mathias-lang-sociomantic commented 9 years ago

Nice, thanks ! However, small nitpick: this works for Allman, but not for OTBS:

version(Foo) {
    // Foo
} else version (Bar) {
    // Bar
  } else {
    // Unsupported                                                                                                     
}
dmakarov commented 9 years ago

The current fix is a bit of a hack. I'll see if I can find a better solution that generally works for multiple choice versions/debug statements.