aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Liu2016-04-07 21:42:40 +0800
committerLeo Liu2016-04-07 21:42:40 +0800
commit96d9e78bd40edff9c901eee1c95ea56d93b55acb (patch)
tree83d8d35b2206f56fb89600693a9011e01d08d9c9
parent20686f7a6430ef37f17b3866f14e7dc3095c1524 (diff)
downloademacs-96d9e78bd40edff9c901eee1c95ea56d93b55acb.tar.gz
emacs-96d9e78bd40edff9c901eee1c95ea56d93b55acb.zip
Fix "Beginning of buffer" error in forward-page
* lisp/textmodes/page.el (forward-page): Check before move to prevent "Beginning of buffer" error.
-rw-r--r--lisp/textmodes/page.el13
1 files changed, 7 insertions, 6 deletions
diff --git a/lisp/textmodes/page.el b/lisp/textmodes/page.el
index 17fda677754..22c73591b91 100644
--- a/lisp/textmodes/page.el
+++ b/lisp/textmodes/page.el
@@ -48,12 +48,13 @@ A page boundary is any line whose beginning matches the regexp
48 (and (save-excursion (re-search-backward page-delimiter nil t)) 48 (and (save-excursion (re-search-backward page-delimiter nil t))
49 (= (match-end 0) (point)) 49 (= (match-end 0) (point))
50 (goto-char (match-beginning 0))) 50 (goto-char (match-beginning 0)))
51 (forward-char -1) 51 (unless (bobp)
52 (if (re-search-backward page-delimiter nil t) 52 (forward-char -1)
53 ;; We found one--move to the end of it. 53 (if (re-search-backward page-delimiter nil t)
54 (goto-char (match-end 0)) 54 ;; We found one--move to the end of it.
55 ;; We found nothing--go to beg of buffer. 55 (goto-char (match-end 0))
56 (goto-char (point-min))) 56 ;; We found nothing--go to beg of buffer.
57 (goto-char (point-min))))
57 (setq count (1+ count)))) 58 (setq count (1+ count))))
58 59
59(defun backward-page (&optional count) 60(defun backward-page (&optional count)