summaryrefslogtreecommitdiff
path: root/rust-mode.el
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
commit1962971cb2f2399528ba82897f210fdf3acf3c5e (patch)
tree71ddc330a994cbe17713d94915b98efd2d3ef4fa /rust-mode.el
parent0e250085d410888d605525f13f30ac07d1754cda (diff)
downloadrust-mode-1962971cb2f2399528ba82897f210fdf3acf3c5e.tar.gz
Correct indent with trailing spaces/comments on previous line
Diffstat (limited to 'rust-mode.el')
-rw-r--r--rust-mode.el5
1 files changed, 3 insertions, 2 deletions
diff --git a/rust-mode.el b/rust-mode.el
index e0f2516..b79d093 100644
--- a/rust-mode.el
+++ b/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 "#")