diff options
| author | Marco Wahl | 2018-04-27 13:50:08 +0200 |
|---|---|---|
| committer | Noam Postavsky | 2018-05-02 20:35:20 -0400 |
| commit | 8a6521260dc650b4b713ea8bc71348cbe730f6e4 (patch) | |
| tree | 370034aad2a21ff4b76b2e2d5ac671439e7630cd | |
| parent | 74ff5ade8002a1a2cc8956607310e5466f2ed596 (diff) | |
| download | emacs-8a6521260dc650b4b713ea8bc71348cbe730f6e4.tar.gz emacs-8a6521260dc650b4b713ea8bc71348cbe730f6e4.zip | |
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 <npostavs@gmail.com>
| -rw-r--r-- | lisp/textmodes/page-ext.el | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/lisp/textmodes/page-ext.el b/lisp/textmodes/page-ext.el index fbdae5892a1..92fce4d364b 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." | |||
| 304 | (or count (setq count 1)) | 304 | (or count (setq count 1)) |
| 305 | (widen) | 305 | (widen) |
| 306 | ;; Cannot use forward-page because of problems at page boundaries. | 306 | ;; Cannot use forward-page because of problems at page boundaries. |
| 307 | (while (and (> count 0) (not (eobp))) | 307 | (if (>= count 0) |
| 308 | (if (re-search-forward page-delimiter nil t) | 308 | (while (and (> count 0) (not (eobp))) |
| 309 | nil | 309 | (if (re-search-forward page-delimiter nil t) |
| 310 | (goto-char (point-max))) | 310 | nil |
| 311 | (setq count (1- count))) | 311 | (goto-char (point-max))) |
| 312 | ;; If COUNT is negative, we want to go back -COUNT + 1 page boundaries. | 312 | (setq count (1- count))) |
| 313 | ;; The first page boundary we reach is the top of the current page, | 313 | ;; If COUNT is negative, we want to go back -COUNT + 1 page boundaries. |
| 314 | ;; which doesn't count. | 314 | ;; The first page boundary we reach is the top of the current page, |
| 315 | (while (and (< count 1) (not (bobp))) | 315 | ;; which doesn't count. |
| 316 | (if (re-search-backward page-delimiter nil t) | 316 | (while (and (< count 1) (not (bobp))) |
| 317 | (goto-char (match-beginning 0)) | 317 | (if (re-search-backward page-delimiter nil t) |
| 318 | (goto-char (point-min))) | 318 | (when (= count 0) |
| 319 | (setq count (1+ count))) | 319 | (goto-char (match-end 0))) |
| 320 | (goto-char (point-min))) | ||
| 321 | (setq count (1+ count)))) | ||
| 320 | (narrow-to-page) | 322 | (narrow-to-page) |
| 321 | (goto-char (point-min)) | 323 | (goto-char (point-min)) |
| 322 | (recenter 0)) | 324 | (recenter 0)) |