summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2017-04-05 10:07:29 -0400
committerGitHub <noreply@github.com>2017-04-05 10:07:29 -0400
commit19e6f604a0c9d838a1426604d70ce3af0960621d (patch)
tree4054adcbe81059b210817a9f3a97ac5061224b3a
parent0de149a9ad04f652cd7a59a9ef67be8a7d86ba76 (diff)
parentd7458c28f39e824c95fd6f75c8d26746fc71b226 (diff)
downloadrust-mode-19e6f604a0c9d838a1426604d70ce3af0960621d.tar.gz
Merge pull request #199 from tromey/open-paren-in-column-0
set open-paren-in-column-0-is-defun-start to nil
-rw-r--r--rust-mode-tests.el15
-rw-r--r--rust-mode.el1
2 files changed, 16 insertions, 0 deletions
diff --git a/rust-mode-tests.el b/rust-mode-tests.el
index 7b29ee1..f7c2a91 100644
--- a/rust-mode-tests.el
+++ b/rust-mode-tests.el
@@ -1876,6 +1876,21 @@ pub fn foo<T,
hello();
}"))
+(ert-deftest indent-open-paren-in-column0 ()
+ ;; Just pass the same text for the "deindented" argument. This
+ ;; avoids the extra spaces normally inserted, which would mess up
+ ;; the test because string contents aren't touched by reindentation.
+ (let ((text "
+const a: &'static str = r#\"
+{}\"#;
+fn main() {
+ let b = \"//\";
+ let c = \"\";
+
+}
+"))
+ (test-indent text text)))
+
(defun rust-test-matching-parens (content pairs &optional nonparen-positions)
"Assert that in rust-mode, given a buffer with the given `content',
emacs's paren matching will find all of the pairs of positions
diff --git a/rust-mode.el b/rust-mode.el
index dfe3e9a..4fadd81 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -1456,6 +1456,7 @@ This is written mainly to be used as `end-of-defun-function' for Rust."
(setq-local comment-start "// ")
(setq-local comment-end "")
(setq-local indent-tabs-mode nil)
+ (setq-local open-paren-in-column-0-is-defun-start nil)
;; Auto indent on }
(setq-local