[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 8a65212 3/3: Fix next-page for dired (Bug#31061)
From: |
Noam Postavsky |
Subject: |
[Emacs-diffs] master 8a65212 3/3: Fix next-page for dired (Bug#31061) |
Date: |
Wed, 2 May 2018 20:36:00 -0400 (EDT) |
branch: master
commit 8a6521260dc650b4b713ea8bc71348cbe730f6e4
Author: Marco Wahl <address@hidden>
Commit: Noam Postavsky <address@hidden>
Fix next-page for dired (Bug#31061)
* lisp/textmodes/page-ext.el (next-page): Don't go back any pages if
COUNT is 0. For negative COUNT, end with point just after the last
delimiter.
Co-authored-by: Noam Postavsky <address@hidden>
---
lisp/textmodes/page-ext.el | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/lisp/textmodes/page-ext.el b/lisp/textmodes/page-ext.el
index fbdae58..92fce4d 100644
--- a/lisp/textmodes/page-ext.el
+++ b/lisp/textmodes/page-ext.el
@@ -304,19 +304,21 @@ With arg (prefix if interactive), move that many pages."
(or count (setq count 1))
(widen)
;; Cannot use forward-page because of problems at page boundaries.
- (while (and (> count 0) (not (eobp)))
- (if (re-search-forward page-delimiter nil t)
- nil
- (goto-char (point-max)))
- (setq count (1- count)))
- ;; If COUNT is negative, we want to go back -COUNT + 1 page boundaries.
- ;; The first page boundary we reach is the top of the current page,
- ;; which doesn't count.
- (while (and (< count 1) (not (bobp)))
- (if (re-search-backward page-delimiter nil t)
- (goto-char (match-beginning 0))
- (goto-char (point-min)))
- (setq count (1+ count)))
+ (if (>= count 0)
+ (while (and (> count 0) (not (eobp)))
+ (if (re-search-forward page-delimiter nil t)
+ nil
+ (goto-char (point-max)))
+ (setq count (1- count)))
+ ;; If COUNT is negative, we want to go back -COUNT + 1 page boundaries.
+ ;; The first page boundary we reach is the top of the current page,
+ ;; which doesn't count.
+ (while (and (< count 1) (not (bobp)))
+ (if (re-search-backward page-delimiter nil t)
+ (when (= count 0)
+ (goto-char (match-end 0)))
+ (goto-char (point-min)))
+ (setq count (1+ count))))
(narrow-to-page)
(goto-char (point-min))
(recenter 0))