emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-25 96d9e78: Fix "Beginning of buffer" error in forwa


From: Leo Liu
Subject: [Emacs-diffs] emacs-25 96d9e78: Fix "Beginning of buffer" error in forward-page
Date: Thu, 07 Apr 2016 13:44:50 +0000

branch: emacs-25
commit 96d9e78bd40edff9c901eee1c95ea56d93b55acb
Author: Leo Liu <address@hidden>
Commit: Leo Liu <address@hidden>

    Fix "Beginning of buffer" error in forward-page
    
    * lisp/textmodes/page.el (forward-page): Check before move to prevent
      "Beginning of buffer" error.
---
 lisp/textmodes/page.el |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/lisp/textmodes/page.el b/lisp/textmodes/page.el
index 17fda677..22c7359 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
     (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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]