X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/f49d1f52b2e368ef67dcfececd426de958548f4e..058e8562775571790e48b1614e84a9617a9e1e17:/lisp/textmodes/page.el diff --git a/lisp/textmodes/page.el b/lisp/textmodes/page.el index 1c213fcbea..22c73591b9 100644 --- a/lisp/textmodes/page.el +++ b/lisp/textmodes/page.el @@ -1,9 +1,8 @@ ;;; page.el --- page motion commands for Emacs -;; Copyright (C) 1985, 2001, 2002, 2003, 2004, 2005, -;; 2006, 2007, 2008, 2009, 2010 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 @@ -49,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) @@ -157,12 +157,11 @@ thus showing a page other than the one point was originally in." (if (= (match-beginning 0) (match-end 0)) (forward-char 1)) (setq count (1+ count))) - (message "Page %d, line %d" - count - (1+ (count-lines (point) opoint))))))) + (message "Page %d, line %d" count (line-number-at-pos opoint)))))) + + ;;; Place `provide' at end of file. (provide 'page) -;; arch-tag: e8d7a0bd-8655-4b6e-b852-f2ee25316a1d ;;; page.el ends here