changeset 20068:9c4fd611c3ec

(narrow-to-page): Check whether forward-page actually set the match data.
author Karl Heuer <kwzh@gnu.org>
date Thu, 16 Oct 1997 18:09:31 +0000
parents 694a165b5b0d
children 1f8e6121713d
files lisp/textmodes/page.el
diffstat 1 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/textmodes/page.el	Thu Oct 16 18:07:23 1997 +0000
+++ b/lisp/textmodes/page.el	Thu Oct 16 18:09:31 1997 +0000
@@ -100,13 +100,17 @@
 		  (setq adjust 1)))
 	    (forward-page (- arg adjust)))))
     ;; Find the end of the page.
+    (set-match-data nil)
     (forward-page)
     ;; If we stopped due to end of buffer, stay there.
     ;; If we stopped after a page delimiter, put end of restriction
     ;; at the beginning of that line.
-    (if (save-excursion
-	  (goto-char (match-beginning 0)) ; was (beginning-of-line)
-	  (looking-at page-delimiter))
+    ;; Before checking the match that was found,
+    ;; verify that forward-page actually set the match data.
+    (if (and (match-beginning 0)
+	     (save-excursion
+	       (goto-char (match-beginning 0)) ; was (beginning-of-line)
+	       (looking-at page-delimiter)))
 	(beginning-of-line))
     (narrow-to-region (point)
 		      (progn