about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMicah Chalmer <micah@micahchalmer.net>2013-08-29 22:59:38 -0400
committerMicah Chalmer <micah@micahchalmer.net>2013-08-29 23:12:08 -0400
commit20def317685b39a35416397b35940a4d040bf72f (patch)
treebe9a81310dcbb7ee3e74547ed3cbe5fe1e22fa62
parent7c6c7519a75064d11f855de862bcdaddcbe5df4b (diff)
Correct indent with trailing spaces/comments on previous line
-rw-r--r--src/etc/emacs/rust-mode.el5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/etc/emacs/rust-mode.el b/src/etc/emacs/rust-mode.el
index e0f25165ddd..b79d09395b0 100644
--- a/src/etc/emacs/rust-mode.el
+++ b/src/etc/emacs/rust-mode.el
@@ -62,7 +62,8 @@
               ;;  - { means indent to either nesting-level * rust-indent-offset,
               ;;    or one further indent from that if either current line
               ;;    begins with 'else', or previous line didn't end in
-              ;;    semi, comma or brace, and wasn't an attribute. PHEW.
+              ;;    semi, comma or brace (other than whitespace and line
+              ;;    comments) , and wasn't an attribute. PHEW.
               ((> level 0)
                (let ((pt (point)))
                  (rust-rewind-irrelevant)
@@ -79,7 +80,7 @@
                          (beginning-of-line)
                          (rust-rewind-irrelevant)
                          (end-of-line)
-                         (if (looking-back "[{};,]")
+                         (if (looking-back "[,;{}][[:space:]]*\\(?://.*\\)?")
                              (* rust-indent-offset level)
                            (back-to-indentation)
                            (if (looking-at "#")