X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/41306318777a942420bc4feadbfacf662ea179dc..25cc0f2aada3e321e5f1c6d1e492a93d16da45b2:/lisp/textmodes/page.el diff --git a/lisp/textmodes/page.el b/lisp/textmodes/page.el index 60e49063c4..22c73591b9 100644 --- a/lisp/textmodes/page.el +++ b/lisp/textmodes/page.el @@ -1,8 +1,8 @@ ;;; page.el --- page motion commands for Emacs -;; Copyright (C) 1985, 2001-2013 Free Software Foundation, Inc. +;; Copyright (C) 1985, 2001-2016 Free Software Foundation, Inc. -;; Maintainer: FSF +;; Maintainer: emacs-devel@gnu.org ;; Keywords: wp convenience ;; Package: emacs @@ -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)