[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rust-mode cb5781d 142/486: Merge pull request #46 from Mic
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rust-mode cb5781d 142/486: Merge pull request #46 from MicahChalmer/fix-fill-region |
Date: |
Sat, 7 Aug 2021 09:25:06 -0400 (EDT) |
branch: elpa/rust-mode
commit cb5781d872fb921346d43f3b2cb29f2cccf262f0
Merge: b15b0eb f2d709e
Author: Felix S Klock II <pnkfelix@pnkfx.org>
Commit: Felix S Klock II <pnkfelix@pnkfx.org>
Merge pull request #46 from MicahChalmer/fix-fill-region
Make fill-region work correctly in comments
---
rust-mode-tests.el | 17 +++++++++++++----
rust-mode.el | 3 ++-
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/rust-mode-tests.el b/rust-mode-tests.el
index 3510d69..b94f041 100644
--- a/rust-mode-tests.el
+++ b/rust-mode-tests.el
@@ -42,9 +42,9 @@
original point-pos manip-func expected (buffer-string)))))
(defun test-fill-paragraph (unfilled expected &optional start-pos end-pos)
- "We're going to run through many scenarios here--the point should be able to
be anywhere from the start-pos (defaults to 1) through end-pos (defaults to the
length of what was passed in) and (fill-paragraph) should return the same
result.
+ "We're going to run through many scenarios here--the point should be able to
be anywhere from the start-pos (defaults to 1) through end-pos (defaults to the
length of what was passed in) and (fill-paragraph) should return the same
result. It should also work with fill-region from start-pos to end-pos.
-Also, the result should be the same regardless of whether the code is at the
beginning or end of the file. (If you're not careful, that can make a
difference.) So we test each position given above with the passed code at the
beginning, the end, neither and both. So we do this a total of (end-pos -
start-pos)*4 times. Oy."
+Also, the result should be the same regardless of whether the code is at the
beginning or end of the file. (If you're not careful, that can make a
difference.) So we test each position given above with the passed code at the
beginning, the end, neither and both. So we do this a total of 1 + (end-pos -
start-pos)*4 times. Oy."
(let* ((start-pos (or start-pos 1))
(end-pos (or end-pos (length unfilled)))
(padding "\n \n")
@@ -69,7 +69,16 @@ Also, the result should be the same regardless of whether
the code is at the beg
(lambda ()
(let ((fill-column rust-test-fill-column))
(fill-paragraph)))
- (concat padding-beginning expected
padding-end)))))))
+ (concat padding-beginning expected padding-end)))))
+ ;; In addition to all the fill-paragraph tests, check that it works using
fill-region
+ (rust-test-manip-code
+ unfilled
+ start-pos
+ (lambda ()
+ (let ((fill-column rust-test-fill-column))
+ (fill-region start-pos end-pos)))
+ expected)
+ ))
(ert-deftest fill-paragraph-top-level-multi-line-style-doc-comment-second-line
()
(test-fill-paragraph
@@ -223,7 +232,7 @@ fn bar() { }"
/// This is my comment. This is
/// more of my comment. This is
/// even more.
-fn bar() { }" 14 67))
+fn bar() { }" 14 85))
(defun test-auto-fill (initial position inserted expected)
(rust-test-manip-code
diff --git a/rust-mode.el b/rust-mode.el
index 9a6eb5f..77fa349 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -508,7 +508,7 @@
(funcall body)))
(defun rust-find-fill-prefix ()
- (rust-with-comment-fill-prefix (lambda () fill-prefix)))
+ (rust-in-comment-paragraph (lambda () (rust-with-comment-fill-prefix (lambda
() fill-prefix)))))
(defun rust-fill-paragraph (&rest args)
"Special wrapping for `fill-paragraph' to handle multi-line comments with a
* prefix on each line."
@@ -704,6 +704,7 @@ This is written mainly to be used as
`end-of-defun-function' for Rust."
(setq-local fill-paragraph-function 'rust-fill-paragraph)
(setq-local fill-forward-paragraph-function 'rust-fill-forward-paragraph)
(setq-local adaptive-fill-function 'rust-find-fill-prefix)
+ (setq-local adaptive-fill-first-line-regexp "")
(setq-local comment-multi-line t)
(setq-local comment-line-break-function 'rust-comment-indent-new-line)
(setq-local imenu-generic-expression rust-imenu-generic-expression)
- [nongnu] elpa/rust-mode f0d4c25 109/486: Fix aligning of method chains (more-or-less) and add various unit tests., (continued)
- [nongnu] elpa/rust-mode f0d4c25 109/486: Fix aligning of method chains (more-or-less) and add various unit tests., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode fd92bfd 111/486: Merge pull request #17 from ramnes/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 149cfdd 106/486: Merge pull request #20 from pnkfelix/fix-broken-tests, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 81d0680 118/486: Fix ERT section of README, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 2038365 120/486: Fix bug in rust-indent-method-chains, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode fea20e7 131/486: Include the last character in indentation tests, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 2e7c6dc 128/486: Add test for raw string with inner quote and hash, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode eaa332e 143/486: Add rust-playpen-buffer and rust-playpen-region for sharing code., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 054a11c 157/486: Update rust-mode URL in header, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 5d0fce5 149/486: Fix word and symbol syntax distinction, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode cb5781d 142/486: Merge pull request #46 from MicahChalmer/fix-fill-region,
ELPA Syncer <=
- [nongnu] elpa/rust-mode 1be7a94 154/486: Merge pull request #57 from pnkfelix/regression-test-for-arrow-openbrace, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 493cc99 148/486: Merge pull request #52 from GBGamer/fix-indent, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode ded5ef7 155/486: Pass explicit second argument to looking-back, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 6d5b02e 153/486: Merge pull request #56 from pnkfelix/pr=fix-word-syntax, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 96f7f79 156/486: Fix free-variable warnings, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 8eb6029 165/486: handle case where blink-matching-paren-distance is nil, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 3798c7e 167/486: fix quoting in two doc strings, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 78e8b08 163/486: Merge pull request #62 from MicahChalmer/a-couple-of-readme-fixes, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 6e72f64 176/486: Fix bugs in raw strings and character literals, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 5937589 169/486: set :safe on two defcustoms, ELPA Syncer, 2021/08/07