diff lisp/mwheel.el @ 90389:146cd8369025

Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-60 Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 259-273) - Update from CVS - lisp/replace.el (occur-engine): Bind `inhibit-field-text-motion' to t - Merge from gnus--rel--5.10 - Rename "field-at-point" to "field-at-pos" - (comint-insert-input): Remove redundant calls to setq and goto-char * gnus--rel--5.10 (patch 99-100) - Merge from emacs--devo--0 - Update from CVS
author Miles Bader <miles@gnu.org>
date Wed, 10 May 2006 20:42:41 +0000
parents 9e490faa9f6b c8171c0fa382
children 95d0cdf160ea
line wrap: on
line diff
--- a/lisp/mwheel.el	Tue May 02 08:50:29 2006 +0000
+++ b/lisp/mwheel.el	Wed May 10 20:42:41 2006 +0000
@@ -204,8 +204,25 @@
       (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)