emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/swift-mode ddc7ae6 436/496: Fix `adaptive-fill-regexp` for


From: ELPA Syncer
Subject: [nongnu] elpa/swift-mode ddc7ae6 436/496: Fix `adaptive-fill-regexp` for multiline comments
Date: Sun, 29 Aug 2021 11:34:23 -0400 (EDT)

branch: elpa/swift-mode
commit ddc7ae671fa5f9834f22f94c3db40d108ead7fb9
Author: taku0 <mxxouy6x3m_github@tatapa.org>
Commit: taku0 <mxxouy6x3m_github@tatapa.org>

    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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]