]> git.eshelyaron.com Git - emacs.git/commitdiff
(forward-paragraph): Fix the logic for handling beginning of buffer
authorRichard M. Stallman <rms@gnu.org>
Sat, 8 Aug 1998 21:31:12 +0000 (21:31 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sat, 8 Aug 1998 21:31:12 +0000 (21:31 +0000)
in the "no fill-prefix" case.

lisp/textmodes/paragraphs.el

index c0199b435dfffe790436adf3eb49cb9d95cf971a..d647419d1233cd9e0413cdc1a2b281cf3d320c63 100644 (file)
@@ -184,7 +184,7 @@ to which the end of the previous line belongs, or the end of the buffer."
            paragraph-separate))
         ;; This is used for searching.
         (sp-paragraph-start (concat "^[ \t]*\\(" paragraph-start "\\)"))
-        start)
+        start found-start)
     (while (and (< arg 0) (not (bobp)))
       (if (and (not (looking-at paragraph-separate))
               (re-search-backward "^\n" (max (1- (point)) (point-min)) t)
@@ -223,18 +223,21 @@ to which the end of the previous line belongs, or the end of the buffer."
 ;;;                     (forward-line 1))
                    (not (bobp)))
                (while (and (re-search-backward sp-paragraph-start nil 1)
+                           (setq found-start t)
                            ;; Found a candidate, but need to check if it is a
                            ;; REAL paragraph-start.
-                           (not (bobp))
                            (progn (setq start (point))
                                   (move-to-left-margin)
                                   (not (looking-at paragraph-separate)))
-                           (or (not (looking-at paragraph-start))
-                               (and use-hard-newlines
-                                    (not (get-text-property (1- start)
-                                                            'hard)))))
+                           (not (and (looking-at paragraph-start)
+                                     (not
+                                      (and use-hard-newlines
+                                           (not (bobp))
+                                           (not (get-text-property (1- start)
+                                                                   'hard)))))))
+                 (setq found-start nil)
                  (goto-char start))
-               (> (point) (point-min)))
+               found-start)
              ;; Found one.
              (progn
                ;; Move forward over paragraph separators.