Commit eeb0f327 authored by Richard M. Stallman's avatar Richard M. Stallman
Browse files

(forward-paragraph): Fix the logic for handling beginning of buffer

in the "no fill-prefix" case.
parent 20cf0008
...@@ -184,7 +184,7 @@ to which the end of the previous line belongs, or the end of the buffer." ...@@ -184,7 +184,7 @@ to which the end of the previous line belongs, or the end of the buffer."
paragraph-separate)) paragraph-separate))
;; This is used for searching. ;; This is used for searching.
(sp-paragraph-start (concat "^[ \t]*\\(" paragraph-start "\\)")) (sp-paragraph-start (concat "^[ \t]*\\(" paragraph-start "\\)"))
start) start found-start)
(while (and (< arg 0) (not (bobp))) (while (and (< arg 0) (not (bobp)))
(if (and (not (looking-at paragraph-separate)) (if (and (not (looking-at paragraph-separate))
(re-search-backward "^\n" (max (1- (point)) (point-min)) t) (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." ...@@ -223,18 +223,21 @@ to which the end of the previous line belongs, or the end of the buffer."
;;; (forward-line 1)) ;;; (forward-line 1))
(not (bobp))) (not (bobp)))
(while (and (re-search-backward sp-paragraph-start nil 1) (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 ;; Found a candidate, but need to check if it is a
;; REAL paragraph-start. ;; REAL paragraph-start.
(not (bobp))
(progn (setq start (point)) (progn (setq start (point))
(move-to-left-margin) (move-to-left-margin)
(not (looking-at paragraph-separate))) (not (looking-at paragraph-separate)))
(or (not (looking-at paragraph-start)) (not (and (looking-at paragraph-start)
(and use-hard-newlines (not
(not (get-text-property (1- start) (and use-hard-newlines
'hard))))) (not (bobp))
(not (get-text-property (1- start)
'hard)))))))
(setq found-start nil)
(goto-char start)) (goto-char start))
(> (point) (point-min))) found-start)
;; Found one. ;; Found one.
(progn (progn
;; Move forward over paragraph separators. ;; Move forward over paragraph separators.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment