]> git.eshelyaron.com Git - emacs.git/commitdiff
(fill-paragraph): Give up if there's no paragraph at or after point.
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 3 Oct 2002 23:01:51 +0000 (23:01 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 3 Oct 2002 23:01:51 +0000 (23:01 +0000)
lisp/ChangeLog
lisp/textmodes/fill.el

index 520a551bcbf7cc61a299d9e4444b74573186e575..eb8bf3d0cf9c9687a189c0a058e1466cb51f9af5 100644 (file)
@@ -1,5 +1,10 @@
 2002-10-03  Stefan Monnier  <monnier@cs.yale.edu>
 
+       * textmodes/fill.el (fill-paragraph): Give up if there's no
+       paragraph at or after point.
+
+       * textmodes/paragraphs.el (forward-paragraph): Return the steps left.
+
        * vc.el (vc-print-log): Unconditionally use `show-log-entry'.
        (vc-default-show-log-entry): New fun.
 
index 8c5a8d35d1afe6eb2076df10828c7bff74130a7e..0bf4b3e5cefaca7c5d32b1ff15ffe3cc47986429 100644 (file)
@@ -697,18 +697,20 @@ If `fill-paragraph-function' is nil, return the `fill-prefix' used for filling."
            ;; Fill prefix used for filling the paragraph.
            fill-pfx)
        (save-excursion
-         (forward-paragraph)
-         (or (bolp) (newline 1))
-         (let ((end (point))
-               (beg (progn (backward-paragraph) (point))))
-           (goto-char before)
-           (setq fill-pfx
-                 (if use-hard-newlines
-                     ;; Can't use fill-region-as-paragraph, since this
-                     ;; paragraph may still contain hard newlines.  See
-                     ;; fill-region.
-                     (fill-region beg end arg)
-                   (fill-region-as-paragraph beg end arg)))))
+         (if (not (zerop (forward-paragraph)))
+             ;; There's no paragraph at or after point: give up.
+             (setq fill-pfx "")
+           (or (bolp) (newline 1))
+           (let ((end (point))
+                 (beg (progn (backward-paragraph) (point))))
+             (goto-char before)
+             (setq fill-pfx
+                   (if use-hard-newlines
+                       ;; Can't use fill-region-as-paragraph, since this
+                       ;; paragraph may still contain hard newlines.  See
+                       ;; fill-region.
+                       (fill-region beg end arg)
+                     (fill-region-as-paragraph beg end arg))))))
        ;; See if point ended up inside the fill-prefix, and if so, move
        ;; past it.
        (skip-line-prefix fill-pfx)