branch: elpa/swift-mode
commit ddc7ae671fa5f9834f22f94c3db40d108ead7fb9
Author: taku0 <[email protected]>
Commit: taku0 <[email protected]>
Fix `adaptive-fill-regexp` for multiline comments
Old:
/** very long line */
↓ fill-region
/** very
/** long
/** line */
Now:
/** very long line */
↓ fill-region
/** very
long
line */
---
swift-mode.el | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/swift-mode.el b/swift-mode.el
index 20d432d..e01c2d0 100644
--- a/swift-mode.el
+++ b/swift-mode.el
@@ -178,7 +178,17 @@ Signal `scan-error' if it hits opening parentheses."
"\\*+ "
"\\)"
"\\s *"))
- (setq-local adaptive-fill-regexp comment-start-skip)
+ (setq-local adaptive-fill-regexp
+ (concat
+ "\\s *"
+ "\\(?:"
+ ;; Single-line comment
+ "//+" ":?" "\\|"
+ ;; Middle of multi-line-comment
+ "\\*+ "
+ "\\)"
+ "\\s *"))
+ (setq-local fill-indent-according-to-mode t)
(setq-local comment-multi-line t)
(setq-local parse-sexp-lookup-properties t)