summaryrefslogtreecommitdiff
path: root/lisp/textmodes
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1997-10-16 18:09:31 +0000
committerKarl Heuer <kwzh@gnu.org>1997-10-16 18:09:31 +0000
commit1577a8fd291813a001d5dfdb7cf35323b40bc40f (patch)
tree4ac26097496c8144220bac65baab3396b1041d3c /lisp/textmodes
parent61185f425d232ec8bd41a94312f31e312b1ded41 (diff)
downloademacs-1577a8fd291813a001d5dfdb7cf35323b40bc40f.tar.gz
(narrow-to-page): Check whether forward-page
actually set the match data.
Diffstat (limited to 'lisp/textmodes')
-rw-r--r--lisp/textmodes/page.el10
1 files changed, 7 insertions, 3 deletions
diff --git a/lisp/textmodes/page.el b/lisp/textmodes/page.el
index 2cc0533535d..e8f5b5d6bbf 100644
--- a/lisp/textmodes/page.el
+++ b/lisp/textmodes/page.el
@@ -100,13 +100,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