@@ -674,8 +674,11 @@ currently using.
674
674
Additional Haskell mode modules can be hooked in via `haskell-mode-hook' ;
675
675
see documentation for that variable for more details."
676
676
:group 'haskell
677
- (set (make-local-variable 'paragraph-start ) (concat " ^$\\ |" page-delimiter))
678
- (set (make-local-variable 'paragraph-separate ) paragraph-start)
677
+ ; ; paragraph-{start,separate} should treat comments as paragraphs as well.
678
+ (set (make-local-variable 'paragraph-start )
679
+ (concat " *{-\\ | *-- |\\ |" page-delimiter))
680
+ (set (make-local-variable 'paragraph-separate )
681
+ (concat " *$\\ | *-- |\\ | *\\ ({-\\ |-}\\ ) *$\\ |" page-delimiter))
679
682
(set (make-local-variable 'fill-paragraph-function ) 'haskell-fill-paragraph )
680
683
; ; (set (make-local-variable 'adaptive-fill-function) 'haskell-adaptive-fill)
681
684
(set (make-local-variable 'adaptive-fill-mode ) nil )
@@ -741,12 +744,22 @@ see documentation for that variable for more details."
741
744
(let* ((comment-start-point (nth 8 syntax-values))
742
745
(comment-end-point
743
746
(save-excursion
744
- (re-search-forward " -}" (point-max ) t comment-num)
747
+ (goto-char comment-start-point)
748
+ (forward-sexp )
749
+ ; ; Find end of any comment even if forward-sexp
750
+ ; ; fails to find the right braces.
751
+ (backward-char 2 )
752
+ (re-search-forward " -}" nil t )
745
753
(point )))
754
+ (fill-start (+ 2 comment-start-point))
755
+ (fill-end (- comment-end-point 2 ))
746
756
(fill-paragraph-handle-comment nil ))
747
757
(save-restriction
748
- (narrow-to-region (+ 2 comment-start-point) (- comment-end-point 2 ))
749
- (fill-paragraph justify))))
758
+ (narrow-to-region fill-start fill-end)
759
+ (fill-paragraph justify)
760
+ ; ; If no filling happens, whatever called us should not
761
+ ; ; continue with standard text filling, so return t
762
+ t )))
750
763
((eolp )
751
764
; ; do nothing outside of a comment
752
765
t )
0 commit comments