summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-11-06 22:42:41 +0000
committerRichard M. Stallman <rms@gnu.org>1996-11-06 22:42:41 +0000
commit7744909b785f8b4b0902a7962c37368c36e09379 (patch)
tree0f4564188aee61b7be06f80313722621ac6475e0 /lisp
parent27ab3270acebca61fa328210a2703d04c0cf1e70 (diff)
downloademacs-7744909b785f8b4b0902a7962c37368c36e09379.tar.gz
(narrow-to-page): With negative arg, move back one extra
page unless we start right after a page delimiter.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/textmodes/page.el11
1 files changed, 10 insertions, 1 deletions
diff --git a/lisp/textmodes/page.el b/lisp/textmodes/page.el
index aecfbd698d7..2cc0533535d 100644
--- a/lisp/textmodes/page.el
+++ b/lisp/textmodes/page.el
@@ -89,7 +89,16 @@ thus showing a page other than the one point was originally in."
(if (> arg 0)
(forward-page arg)
(if (< arg 0)
- (forward-page (1- arg))))
+ (let ((adjust 0)
+ (opoint (point)))
+ ;; If we are not now at the beginning of a page,
+ ;; move back one extra time, to get to the start of this page.
+ (save-excursion
+ (beginning-of-line)
+ (or (and (looking-at page-delimiter)
+ (eq (match-end 0) opoint))
+ (setq adjust 1)))
+ (forward-page (- arg adjust)))))
;; Find the end of the page.
(forward-page)
;; If we stopped due to end of buffer, stay there.