Fix "Beginning of buffer" error in forward-page

* lisp/textmodes/page.el (forward-page): Check before move to prevent
  "Beginning of buffer" error.
This commit is contained in:
Leo Liu 2016-04-07 21:42:40 +08:00
parent 20686f7a64
commit 96d9e78bd4

View file

@ -48,12 +48,13 @@ A page boundary is any line whose beginning matches the regexp
(and (save-excursion (re-search-backward page-delimiter nil t))
(= (match-end 0) (point))
(goto-char (match-beginning 0)))
(forward-char -1)
(if (re-search-backward page-delimiter nil t)
;; 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)))
(unless (bobp)
(forward-char -1)
(if (re-search-backward page-delimiter nil t)
;; 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)