]> code.delx.au - gnu-emacs/blobdiff - lisp/textmodes/page.el
*** empty log message ***
[gnu-emacs] / lisp / textmodes / page.el
index 2cc0533535d490980c5ef3f2117a84bb2190163a..ec09153d139398fdbf08a1145274fa5c36e626e4 100644 (file)
@@ -1,8 +1,9 @@
-;;; page.el --- page motion commands for emacs.
+;;; page.el --- page motion commands for Emacs
 
 ;; Copyright (C) 1985 Free Software Foundation, Inc.
 
 ;; Maintainer: FSF
+;; Keywords: wp convenience
 
 ;; This file is part of GNU Emacs.
 
@@ -100,13 +101,17 @@ thus showing a page other than the one point was originally in."
                  (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