branch: elpa/scala-mode commit d65f062afd163c226000f8100d554035c00d91ef Author: Seth Tisue <s...@tisue.net> Commit: Seth Tisue <s...@tisue.net>
indent `while` like `if`, `for` et al (fixes #22) --- README.md | 15 +++++++++++++++ scala-mode-indent.el | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d6ae63a..863a7e8 100644 --- a/README.md +++ b/README.md @@ -318,6 +318,21 @@ customization variable *frame-background-mode* to *dark* (use **M-x** - highlights only properly formatted string and character constants - indenting a code line removes trailing whitespace +## Known issues + +*do/while* is not always handled correctly. For example: + +```scala +do + foo +while (bar) + foo +``` + +The indenter thinks the second occurrence of `foo` is the body of the while. +To work around this, terminate the while with a semicolon, +or put a blank line after it. + ## Future work - syntax-begin-function for reliably fontifying elements which span diff --git a/scala-mode-indent.el b/scala-mode-indent.el index cb5d6e4..4d4920e 100644 --- a/scala-mode-indent.el +++ b/scala-mode-indent.el @@ -506,7 +506,7 @@ point or nil if the point is not in a enumerator element > 1." ;;; (defconst scala-indent:value-keyword-re - (regexp-opt '("if" "else" "yield" "for" "try" "finally" "catch") 'words)) + (regexp-opt '("if" "else" "while" "yield" "for" "try" "finally" "catch") 'words)) (defun scala-indent:body-p (&optional point) "Returns the position of '=', 'if or 'else if' (TODO: or '=>')