Synch with Oort Gnus.
[elisp/gnus.git-] / lisp / flow-fill.el
index 64946f9..8a9bea0 100644 (file)
@@ -38,7 +38,7 @@
 ;; Todo: encoding, implement basic `fill-region' (Emacs and XEmacs
 ;;       implementations differ..)
 
-;; History:
+;;; History:
 
 ;; 2000-02-17  posted on ding mailing list
 ;; 2000-02-19  use `point-at-{b,e}ol' in XEmacs
 
 (eval-and-compile
   (defalias 'fill-flowed-point-at-bol
-       (if (fboundp 'point-at-bol)
-           'point-at-bol
-         'line-beginning-position))
+    (if (fboundp 'point-at-bol)
+       'point-at-bol
+      'line-beginning-position))
 
-   (defalias 'fill-flowed-point-at-eol
-       (if (fboundp 'point-at-eol)
-           'point-at-eol
-         'line-end-position)))
+  (defalias 'fill-flowed-point-at-eol
+    (if (fboundp 'point-at-eol)
+       'point-at-eol
+      'line-end-position)))
 
 (defun fill-flowed (&optional buffer)
   (save-excursion
@@ -86,7 +86,8 @@
                      (save-excursion
                        (unless (eobp)
                          (forward-char 1)
-                         (looking-at (format "^\\(%s\\)\\([^>]\\)" (or quote " ?"))))))
+                         (looking-at (format "^\\(%s\\)\\([^>]\\)"
+                                             (or quote " ?"))))))
            (save-excursion
              (replace-match (if (string= (match-string 2) " ")
                                 "" "\\2")))
@@ -95,7 +96,7 @@
          (unless sig
            (let ((fill-prefix (when quote (concat quote " "))))
              (fill-region (fill-flowed-point-at-bol)
-                          (fill-flowed-point-at-eol)
+                          (min (1+ (fill-flowed-point-at-eol)) (point-max))
                           'left 'nosqueeze))))))))
 
 (provide 'flow-fill)