diff options
| author | Richard M. Stallman | 1996-01-12 21:23:05 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-01-12 21:23:05 +0000 |
| commit | b69863f29d2252585cfcc29add96d23deae7167d (patch) | |
| tree | 706613585e107cd051c12f42ae41e1256c09b25d | |
| parent | 1caf38ebbc2750d7639a3aed1525771642492cd8 (diff) | |
| download | emacs-b69863f29d2252585cfcc29add96d23deae7167d.tar.gz emacs-b69863f29d2252585cfcc29add96d23deae7167d.zip | |
(forward-page): Simplify how we avoid getting stuck when moving backwards.
| -rw-r--r-- | lisp/textmodes/page.el | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/lisp/textmodes/page.el b/lisp/textmodes/page.el index d84d7f5a07b..c110ca842ed 100644 --- a/lisp/textmodes/page.el +++ b/lisp/textmodes/page.el | |||
| @@ -42,19 +42,17 @@ A page boundary is any line whose beginning matches the regexp | |||
| 42 | (goto-char (point-max))) | 42 | (goto-char (point-max))) |
| 43 | (setq count (1- count))) | 43 | (setq count (1- count))) |
| 44 | (while (and (< count 0) (not (bobp))) | 44 | (while (and (< count 0) (not (bobp))) |
| 45 | ;; In case the page-delimiter matches the null string, | ||
| 46 | ;; don't find a match without moving. | ||
| 47 | (and (save-excursion (re-search-backward page-delimiter nil t)) | ||
| 48 | (= (match-end 0) (point)) | ||
| 49 | (goto-char (match-beginning 0))) | ||
| 45 | (forward-char -1) | 50 | (forward-char -1) |
| 46 | (let (result (end (point))) | 51 | (if (re-search-backward page-delimiter nil t) |
| 47 | ;; If we find a match that ends where we started searching, | 52 | ;; We found one--move to the end of it. |
| 48 | ;; look for another one. | 53 | (goto-char (match-end 0)) |
| 49 | (while (and (setq result (re-search-backward page-delimiter nil t)) | 54 | ;; We found nothing--go to beg of buffer. |
| 50 | (= (match-end 0) end)) | 55 | (goto-char (point-min))) |
| 51 | ;; Just search again. | ||
| 52 | ) | ||
| 53 | (if result | ||
| 54 | ;; We found one--move to the end of it. | ||
| 55 | (goto-char (match-end 0)) | ||
| 56 | ;; We found nothing--go to beg of buffer. | ||
| 57 | (goto-char (point-min)))) | ||
| 58 | (setq count (1+ count)))) | 56 | (setq count (1+ count)))) |
| 59 | 57 | ||
| 60 | (defun backward-page (&optional count) | 58 | (defun backward-page (&optional count) |