diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2006-05-08 15:14:26 +0000 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2006-05-08 15:14:26 +0000 |
commit | 44a50ffdbfcdade95964f4123e4249c3a8bc9eb2 (patch) | |
tree | 6e833bc6b4669e765f8ea2cd92c86f2c714a71dd /lisp/mwheel.el | |
parent | 8c87a72c22623843fea4af61601b7710579c9cc2 (diff) | |
download | emacs-44a50ffdbfcdade95964f4123e4249c3a8bc9eb2.tar.gz |
(mwheel-scroll): Make sure that when scrolling multiple
pages at a time, if we signal the end, we should indeed reach that end.
Diffstat (limited to 'lisp/mwheel.el')
-rw-r--r-- | lisp/mwheel.el | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lisp/mwheel.el b/lisp/mwheel.el index 662b992b343..b61971c7ea5 100644 --- a/lisp/mwheel.el +++ b/lisp/mwheel.el @@ -204,8 +204,25 @@ This should only be bound to mouse buttons 4 and 5." (setq amt (* amt (event-click-count event)))) (unwind-protect (let ((button (mwheel-event-button event))) - (cond ((eq button mouse-wheel-down-event) (scroll-down amt)) - ((eq button mouse-wheel-up-event) (scroll-up amt)) + (cond ((eq button mouse-wheel-down-event) + (condition-case nil (scroll-down amt) + ;; Make sure we do indeed scroll to the beginning of + ;; the buffer. + (beginning-of-buffer + (unwind-protect + (scroll-down) + ;; If the first scroll succeeded, then some scrolling + ;; is possible: keep scrolling til the beginning but + ;; do not signal an error. For some reason, we have + ;; to do it even if the first scroll signalled an + ;; error, because otherwise the window is recentered + ;; for a reason that escapes me. This problem seems + ;; to only affect scroll-down. --Stef + (set-window-start (selected-window) (point-min)))))) + ((eq button mouse-wheel-up-event) + (condition-case nil (scroll-up amt) + ;; Make sure we do indeed scroll to the end of the buffer. + (end-of-buffer (while t (scroll-up))))) (t (error "Bad binding in mwheel-scroll")))) (if curwin (select-window curwin)))) (when (and mouse-wheel-click-event mouse-wheel-inhibit-click-time) |