[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rust-mode a33b684 207/486: Fix #103: comment indentation a
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rust-mode a33b684 207/486: Fix #103: comment indentation after struct members |
Date: |
Sat, 7 Aug 2021 09:25:20 -0400 (EDT) |
branch: elpa/rust-mode
commit a33b684a027b8f5efb1e197d7f3e294d2f271f26
Author: mrBliss <dewinant@gmail.com>
Commit: mrBliss <dewinant@gmail.com>
Fix #103: comment indentation after struct members
Correctly indent comments that come after struct members that do not
have a trailing comma.
Before:
struct A {
x: u8
// TOO FAR
}
After:
struct A {
x: u8
// CORRECT
}
---
rust-mode-tests.el | 18 ++++++++++++++++++
rust-mode.el | 4 +++-
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/rust-mode-tests.el b/rust-mode-tests.el
index e621f82..eb13128 100644
--- a/rust-mode-tests.el
+++ b/rust-mode-tests.el
@@ -600,6 +600,24 @@ fn foo() {
"
))
+;; This is a test for #103: a comment after the last struct member that does
+;; not have a trailing comma. The comment used to be indented one stop too
+;; far.
+(ert-deftest indent-comment-after-last-struct-member ()
+ (test-indent
+ "
+struct A {
+ x: u8
+ // comment
+}
+
+struct A {
+ x: u8
+ /* comment */
+}
+"
+ ))
+
(setq rust-test-motion-string
"
fn fn1(arg: int) -> bool {
diff --git a/rust-mode.el b/rust-mode.el
index 5b50d29..bc03023 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -369,7 +369,9 @@
;; baseline as well (we are continuing an expression,
;; but the "else" or "{" should align with the beginning
;; of the expression it's in.)
- (looking-at "\\<else\\>\\|{")
+ ;; Or, if this line starts a comment, stay on the
+ ;; baseline as well.
+ (looking-at "\\<else\\>\\|{\\|/[/*]")
(save-excursion
(rust-rewind-irrelevant)
- [nongnu] elpa/rust-mode 3a65c56 018/486: update readme, (continued)
- [nongnu] elpa/rust-mode 3a65c56 018/486: update readme, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 8d6ea12 019/486: Add author to meta-data, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 4b56ffe 020/486: update readme with package.el installation steps, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 58c47a3 021/486: add instructions for install from MELPA, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode bda009d 023/486: add auto-mode-alist to autoloads, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode aa3ee6a 026/486: rust-mode: Add pub and priv, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode ac92ff6 037/486: etc: add the `in` keyword to the emacs mode., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 9640fe8 051/486: Indent return type to align with arguments, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 0256f02 302/486: Fix stupid mistake in rustfmt conditional, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 3220937 304/486: Merge pull request #209 from tromey/default-keyword, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode a33b684 207/486: Fix #103: comment indentation after struct members,
ELPA Syncer <=
- [nongnu] elpa/rust-mode 339afba 206/486: Highlight the unsafe keyword, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode fa5b38f 218/486: Merge pull request #117 from TheBB/fix-closing-delim, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 1ceac8b 212/486: Re-fontify buffer after it is reverted, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 01db4cb 225/486: Fix font-locking for Unicode escapes in character literals., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode b874bbe 213/486: Merge pull request #113 from MicahChalmer/fix-issue-104, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 2cd3cf9 216/486: Merge pull request #116 from Wilfred/type_annotation_highlighting, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 3517321 230/486: Merge pull request #129 from MicahChalmer/fix-issue-127, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 8400638 241/486: update README.md and Package-Requires to require emacs 24, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode c3feac1 243/486: Fill regular block comments correctly too, in addition to rustdoc comments, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 1587839 268/486: Merge pull request #169 from mrBliss/fix-168, ELPA Syncer, 2021/08/07