[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/go-mode 4f15abf 449/495: Fix fill-paragraph for certain bl
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/go-mode 4f15abf 449/495: Fix fill-paragraph for certain block comments. |
Date: |
Sat, 7 Aug 2021 09:06:06 -0400 (EDT) |
branch: elpa/go-mode
commit 4f15abf0e8822c24e45590ef3f161e97920568aa
Author: Muir Manders <muir@mnd.rs>
Commit: Peter Sanford <psanford@sanford.io>
Fix fill-paragraph for certain block comments.
We weren't filling cases like this properly:
/*
Hello I am
an important comment.
*/
Now we properly detect the fill prefix that precedes "Hello".
---
go-mode.el | 21 ++++++++++++++-------
test/go-fill-paragraph-test.el | 22 ++++++++++++++++++++++
2 files changed, 36 insertions(+), 7 deletions(-)
diff --git a/go-mode.el b/go-mode.el
index a5a6890..85d1bf5 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -656,13 +656,20 @@ case keyword. It returns nil for the case line itself."
(or (go--empty-line-p) (go--boring-comment-p))
(zerop (forward-line 1))))
- ;; If we are looking at the start of an interesting comment, our
- ;; prefix is the comment opener and any space following.
- (if (looking-at (concat go--comment-start-regexp "[[:space:]]*"))
- ;; Replace "/*" opener with spaces so following lines don't
- ;; get "/*" prefix.
- (replace-regexp-in-string "/\\*" " "
- (match-string-no-properties 0)))))
+ ;; If we are in a block comment, set prefix based on first line
+ ;; with content.
+ (if (go-in-comment-p)
+ (progn
+ (looking-at "[[:space:]]*")
+ (match-string-no-properties 0))
+
+ ;; Else if we are looking at the start of an interesting comment, our
+ ;; prefix is the comment opener and any space following.
+ (if (looking-at (concat go--comment-start-regexp "[[:space:]]*"))
+ ;; Replace "/*" opener with spaces so following lines don't
+ ;; get "/*" prefix.
+ (replace-regexp-in-string "/\\*" " "
+ (match-string-no-properties 0))))))
(defun go--fill-paragraph (&rest args)
"Wrap fill-paragraph to set custom fill-prefix."
diff --git a/test/go-fill-paragraph-test.el b/test/go-fill-paragraph-test.el
index 7a2c34e..5775018 100644
--- a/test/go-fill-paragraph-test.el
+++ b/test/go-fill-paragraph-test.el
@@ -127,6 +127,28 @@ func main() {
}"
))
+
+(ert-deftest go--fill-paragraph-block-offset ()
+ (go--should-fill
+ "
+func main() {
+<> /*
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit,
+ sed do eiusmod tempor incididunt ut labore
+ et dolore magna aliqua.
+ */
+}"
+
+ "
+func main() {
+ /*
+ Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed
+ do eiusmod tempor incididunt ut labore et dolore magna aliqua.
+ */
+}"
+ ))
+
+
(ert-deftest go--fill-paragraph-block-region ()
(go--should-fill
"
- [nongnu] elpa/go-mode f6b1398 429/495: Fix filename handling in godoc-gogetdoc, (continued)
- [nongnu] elpa/go-mode f6b1398 429/495: Fix filename handling in godoc-gogetdoc, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 00e72cd 431/495: Update default for godoc-and-godef-command, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 6b67088 432/495: Support trailing commas as dangling operators., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 8ddf0b3 433/495: Speed up go-goto-opening-parenthesis, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode fdc1545 436/495: Fix indent for case statement comments, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode d387378 438/495: indent: handle comments after multiline case lists, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode fbf2544 444/495: Improve fill-paragraph for comment blocks., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode e7e0157 447/495: indent: fix indent at top level of file, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 3bc7479 450/495: Fix infinite loop in fill-region, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 88ffc9e 452/495: Add github action yaml file to run ert tests, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 4f15abf 449/495: Fix fill-paragraph for certain block comments.,
ELPA Syncer <=
- [nongnu] elpa/go-mode a13b814 448/495: Add option to reuse a single buffer for godoc, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode a82369b 453/495: Readme: add basic information about gopls., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 839190b 455/495: Run all tests in GH CI, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 7248358 462/495: Fontify type names in type switch statements, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 4fabba6 464/495: Small fix for fontification of array types, ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 656590a 463/495: Fontify qualified composite literal types., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode d304565 474/495: Fix signature fontification after comments., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode e9b9c0e 473/495: Add some fontification faces for go-dot-mod-mode., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode 4acf733 468/495: Fully fontify type and const decls., ELPA Syncer, 2021/08/07
- [nongnu] elpa/go-mode dac200f 469/495: Fix font locking in nested signatures., ELPA Syncer, 2021/08/07