Mercurial > emacs
changeset 8751:5b4ba06e910f
(forward-page): If we find a match that ends where we
started searching, look for another one.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Thu, 15 Sep 1994 03:21:56 +0000 |
parents | b13519279d73 |
children | 67b1905bc9a2 |
files | lisp/textmodes/page.el |
diffstat | 1 files changed, 12 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/textmodes/page.el Thu Sep 15 03:10:00 1994 +0000 +++ b/lisp/textmodes/page.el Thu Sep 15 03:21:56 1994 +0000 @@ -43,9 +43,18 @@ (setq count (1- count))) (while (and (< count 0) (not (bobp))) (forward-char -1) - (if (re-search-backward page-delimiter nil t) - (goto-char (match-end 0)) - (goto-char (point-min))) + (let (result (end (point))) + ;; If we find a match that ends where we started searching, + ;; look for another one. + (while (and (setq result (re-search-backward page-delimiter nil t)) + (= (match-end 0) end)) + ;; Just search again. + ) + (if result + ;; We found one--move to the end of it. + (goto-char (match-end 0)) + ;; We found nothing--go to beg of buffer. + (goto-char (point-min)))) (setq count (1+ count)))) (defun backward-page (&optional count)