Skip to content

Commit ddc7ae6

Browse files
committed
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 */
1 parent 1362849 commit ddc7ae6

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

swift-mode.el

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,17 @@ Signal `scan-error' if it hits opening parentheses."
178178
"\\*+ "
179179
"\\)"
180180
"\\s *"))
181-
(setq-local adaptive-fill-regexp comment-start-skip)
181+
(setq-local adaptive-fill-regexp
182+
(concat
183+
"\\s *"
184+
"\\(?:"
185+
;; Single-line comment
186+
"//+" ":?" "\\|"
187+
;; Middle of multi-line-comment
188+
"\\*+ "
189+
"\\)"
190+
"\\s *"))
191+
(setq-local fill-indent-according-to-mode t)
182192
(setq-local comment-multi-line t)
183193

184194
(setq-local parse-sexp-lookup-properties t)

0 commit comments

Comments
 (0)