aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1997-10-16 18:09:31 +0000
committerKarl Heuer1997-10-16 18:09:31 +0000
commit1577a8fd291813a001d5dfdb7cf35323b40bc40f (patch)
tree4ac26097496c8144220bac65baab3396b1041d3c
parent61185f425d232ec8bd41a94312f31e312b1ded41 (diff)
downloademacs-1577a8fd291813a001d5dfdb7cf35323b40bc40f.tar.gz
emacs-1577a8fd291813a001d5dfdb7cf35323b40bc40f.zip
(narrow-to-page): Check whether forward-page
actually set the match data.
-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."
100 (setq adjust 1))) 100 (setq adjust 1)))
101 (forward-page (- arg adjust))))) 101 (forward-page (- arg adjust)))))
102 ;; Find the end of the page. 102 ;; Find the end of the page.
103 (set-match-data nil)
103 (forward-page) 104 (forward-page)
104 ;; If we stopped due to end of buffer, stay there. 105 ;; If we stopped due to end of buffer, stay there.
105 ;; If we stopped after a page delimiter, put end of restriction 106 ;; If we stopped after a page delimiter, put end of restriction
106 ;; at the beginning of that line. 107 ;; at the beginning of that line.
107 (if (save-excursion 108 ;; Before checking the match that was found,
108 (goto-char (match-beginning 0)) ; was (beginning-of-line) 109 ;; verify that forward-page actually set the match data.
109 (looking-at page-delimiter)) 110 (if (and (match-beginning 0)
111 (save-excursion
112 (goto-char (match-beginning 0)) ; was (beginning-of-line)
113 (looking-at page-delimiter)))
110 (beginning-of-line)) 114 (beginning-of-line))
111 (narrow-to-region (point) 115 (narrow-to-region (point)
112 (progn 116 (progn