diff options
| author | Juri Linkov | 2019-07-08 01:35:35 +0300 |
|---|---|---|
| committer | Juri Linkov | 2019-07-08 01:35:35 +0300 |
| commit | 8d09cb21f8ad4c3d3197dadfcc38fe925da558d0 (patch) | |
| tree | e4d3f94710b15e77aa7f35920fb2ebcc75523847 | |
| parent | 3bffc09d17cf7edf46e3834edd84520a493d2239 (diff) | |
| download | emacs-8d09cb21f8ad4c3d3197dadfcc38fe925da558d0.tar.gz emacs-8d09cb21f8ad4c3d3197dadfcc38fe925da558d0.zip | |
Handle scroll-error-top-bottom in follow.el and view.el (bug#21893)
* lisp/follow.el (follow-scroll-up-arg, follow-scroll-up-window):
Use scroll-up-command instead of scroll-up.
(follow-scroll-down-arg, follow-scroll-down-window):
Use scroll-down-command instead of scroll-down.
(follow-scroll-up, follow-scroll-down): Handle scroll-error-top-bottom.
* lisp/view.el (view-scroll-lines): Use scroll-down-command
instead of scroll-down and scroll-up-command instead of scroll-up.
(view-really-at-end): Handle scroll-error-top-bottom.
| -rw-r--r-- | lisp/follow.el | 22 | ||||
| -rw-r--r-- | lisp/view.el | 7 |
2 files changed, 18 insertions, 11 deletions
diff --git a/lisp/follow.el b/lisp/follow.el index acc2b26c550..faac87986bb 100644 --- a/lisp/follow.el +++ b/lisp/follow.el | |||
| @@ -557,7 +557,7 @@ This is an internal function for `follow-scroll-up' and | |||
| 557 | (let ((opoint (point)) (owin (selected-window))) | 557 | (let ((opoint (point)) (owin (selected-window))) |
| 558 | (while | 558 | (while |
| 559 | ;; If we are too near EOB, try scrolling the previous window. | 559 | ;; If we are too near EOB, try scrolling the previous window. |
| 560 | (condition-case nil (progn (scroll-up arg) nil) | 560 | (condition-case nil (progn (scroll-up-command arg) nil) |
| 561 | (end-of-buffer | 561 | (end-of-buffer |
| 562 | (condition-case nil (progn (follow-previous-window) t) | 562 | (condition-case nil (progn (follow-previous-window) t) |
| 563 | (error | 563 | (error |
| @@ -576,7 +576,7 @@ If ARG is nil, scroll the size of the current window. | |||
| 576 | This is an internal function for `follow-scroll-down' and | 576 | This is an internal function for `follow-scroll-down' and |
| 577 | `follow-scroll-down-window'." | 577 | `follow-scroll-down-window'." |
| 578 | (let ((opoint (point))) | 578 | (let ((opoint (point))) |
| 579 | (scroll-down arg) | 579 | (scroll-down-command arg) |
| 580 | (unless (and scroll-preserve-screen-position | 580 | (unless (and scroll-preserve-screen-position |
| 581 | (get this-command 'scroll-command)) | 581 | (get this-command 'scroll-command)) |
| 582 | (goto-char opoint)) | 582 | (goto-char opoint)) |
| @@ -596,7 +596,7 @@ Negative ARG means scroll downward. | |||
| 596 | Works like `scroll-up' when not in Follow mode." | 596 | Works like `scroll-up' when not in Follow mode." |
| 597 | (interactive "P") | 597 | (interactive "P") |
| 598 | (cond ((not follow-mode) | 598 | (cond ((not follow-mode) |
| 599 | (scroll-up arg)) | 599 | (scroll-up-command arg)) |
| 600 | ((eq arg '-) | 600 | ((eq arg '-) |
| 601 | (follow-scroll-down-window)) | 601 | (follow-scroll-down-window)) |
| 602 | (t (follow-scroll-up-arg arg)))) | 602 | (t (follow-scroll-up-arg arg)))) |
| @@ -616,7 +616,7 @@ Negative ARG means scroll upward. | |||
| 616 | Works like `scroll-down' when not in Follow mode." | 616 | Works like `scroll-down' when not in Follow mode." |
| 617 | (interactive "P") | 617 | (interactive "P") |
| 618 | (cond ((not follow-mode) | 618 | (cond ((not follow-mode) |
| 619 | (scroll-down arg)) | 619 | (scroll-down-command arg)) |
| 620 | ((eq arg '-) | 620 | ((eq arg '-) |
| 621 | (follow-scroll-up-window)) | 621 | (follow-scroll-up-window)) |
| 622 | (t (follow-scroll-down-arg arg)))) | 622 | (t (follow-scroll-down-arg arg)))) |
| @@ -635,13 +635,16 @@ Negative ARG means scroll downward. | |||
| 635 | Works like `scroll-up' when not in Follow mode." | 635 | Works like `scroll-up' when not in Follow mode." |
| 636 | (interactive "P") | 636 | (interactive "P") |
| 637 | (cond ((not follow-mode) | 637 | (cond ((not follow-mode) |
| 638 | (scroll-up arg)) | 638 | (scroll-up-command arg)) |
| 639 | (arg (follow-scroll-up-arg arg)) | 639 | (arg (follow-scroll-up-arg arg)) |
| 640 | (t | 640 | (t |
| 641 | (let* ((windows (follow-all-followers)) | 641 | (let* ((windows (follow-all-followers)) |
| 642 | (end (window-end (car (reverse windows))))) | 642 | (end (window-end (car (reverse windows))))) |
| 643 | (if (eq end (point-max)) | 643 | (if (eq end (point-max)) |
| 644 | (signal 'end-of-buffer nil) | 644 | (if (or (null scroll-error-top-bottom) |
| 645 | (eobp)) | ||
| 646 | (signal 'end-of-buffer nil) | ||
| 647 | (goto-char (point-max))) | ||
| 645 | (select-window (car windows)) | 648 | (select-window (car windows)) |
| 646 | ;; `window-end' might return nil. | 649 | ;; `window-end' might return nil. |
| 647 | (if end | 650 | (if end |
| @@ -663,14 +666,17 @@ Negative ARG means scroll upward. | |||
| 663 | Works like `scroll-down' when not in Follow mode." | 666 | Works like `scroll-down' when not in Follow mode." |
| 664 | (interactive "P") | 667 | (interactive "P") |
| 665 | (cond ((not follow-mode) | 668 | (cond ((not follow-mode) |
| 666 | (scroll-down arg)) | 669 | (scroll-down-command arg)) |
| 667 | (arg (follow-scroll-down-arg arg)) | 670 | (arg (follow-scroll-down-arg arg)) |
| 668 | (t | 671 | (t |
| 669 | (let* ((windows (follow-all-followers)) | 672 | (let* ((windows (follow-all-followers)) |
| 670 | (win (car (reverse windows))) | 673 | (win (car (reverse windows))) |
| 671 | (start (window-start (car windows)))) | 674 | (start (window-start (car windows)))) |
| 672 | (if (eq start (point-min)) | 675 | (if (eq start (point-min)) |
| 673 | (signal 'beginning-of-buffer nil) | 676 | (if (or (null scroll-error-top-bottom) |
| 677 | (bobp)) | ||
| 678 | (signal 'beginning-of-buffer nil) | ||
| 679 | (goto-char (point-min))) | ||
| 674 | (select-window win) | 680 | (select-window win) |
| 675 | (goto-char start) | 681 | (goto-char start) |
| 676 | (vertical-motion (- (- (window-height win) | 682 | (vertical-motion (- (- (window-height win) |
diff --git a/lisp/view.el b/lisp/view.el index a765be02c1e..e4489b391a9 100644 --- a/lisp/view.el +++ b/lisp/view.el | |||
| @@ -743,18 +743,19 @@ invocations return to earlier marks." | |||
| 743 | (setq backward (not backward) lines (- lines))) | 743 | (setq backward (not backward) lines (- lines))) |
| 744 | (when (and maxdefault lines (> lines (view-window-size))) | 744 | (when (and maxdefault lines (> lines (view-window-size))) |
| 745 | (setq lines nil)) | 745 | (setq lines nil)) |
| 746 | (cond (backward (scroll-down lines)) | 746 | (cond (backward (scroll-down-command lines)) |
| 747 | ((view-really-at-end) | 747 | ((view-really-at-end) |
| 748 | (if view-scroll-auto-exit | 748 | (if view-scroll-auto-exit |
| 749 | (View-quit) | 749 | (View-quit) |
| 750 | (ding) | 750 | (ding) |
| 751 | (view-end-message))) | 751 | (view-end-message))) |
| 752 | (t (scroll-up lines) | 752 | (t (scroll-up-command lines) |
| 753 | (if (view-really-at-end) (view-end-message))))) | 753 | (if (view-really-at-end) (view-end-message))))) |
| 754 | 754 | ||
| 755 | (defun view-really-at-end () | 755 | (defun view-really-at-end () |
| 756 | ;; Return true if buffer end visible. Maybe revert buffer and test. | 756 | ;; Return true if buffer end visible. Maybe revert buffer and test. |
| 757 | (and (pos-visible-in-window-p (point-max)) | 757 | (and (or (null scroll-error-top-bottom) (eobp)) |
| 758 | (pos-visible-in-window-p (point-max)) | ||
| 758 | (let ((buf (current-buffer)) | 759 | (let ((buf (current-buffer)) |
| 759 | (bufname (buffer-name)) | 760 | (bufname (buffer-name)) |
| 760 | (file (buffer-file-name))) | 761 | (file (buffer-file-name))) |