Skip to content

Commit 20def31

Browse files
committed
Correct indent with trailing spaces/comments on previous line
1 parent 7c6c751 commit 20def31

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/etc/emacs/rust-mode.el

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@
6262
;; - { means indent to either nesting-level * rust-indent-offset,
6363
;; or one further indent from that if either current line
6464
;; begins with 'else', or previous line didn't end in
65-
;; semi, comma or brace, and wasn't an attribute. PHEW.
65+
;; semi, comma or brace (other than whitespace and line
66+
;; comments) , and wasn't an attribute. PHEW.
6667
((> level 0)
6768
(let ((pt (point)))
6869
(rust-rewind-irrelevant)
@@ -79,7 +80,7 @@
7980
(beginning-of-line)
8081
(rust-rewind-irrelevant)
8182
(end-of-line)
82-
(if (looking-back "[{};,]")
83+
(if (looking-back "[,;{}][[:space:]]*\\(?://.*\\)?")
8384
(* rust-indent-offset level)
8485
(back-to-indentation)
8586
(if (looking-at "#")

0 commit comments

Comments
 (0)