This library lets you scroll the window by just dragging the mouse.


This has been a long time topic on my wishlist and GNU Emacs already hat it :-). I really don't like to use the scrollbar for scrolling because I have to precisely aim with the mouse to hit it. I thought it would be quite cool to just hit a magic key a then moving the mouse would scroll just as likely.


Well, this is exactly what this library does. The magic key is the middle mouse button with or without the control key (unfortunately both of this is currently hard coded).

If you hold the middle mouse button and drag the mouse you can move the contents around a littlebit like you'd grabbed a character with the mouse. This is similar to the moving inside the canvas in Gimp (and similar to mouse-drag.el) besides not being able to move horizontally. But then who needs horizontal scrolling anyway.

If you perform the same action while also holding the control key the whole height of the window is taken as a 0 to 100% range just like the scrollbar does. The only strange part in this is that the buffer is immediately scrolled to approximately the percentage you clicked. This might sound difficult but is actually very simple. Just give it a try.


Download: track-scroll.el

Put into your init file (.emacs or .xemacs/init.el or personal.el):

     (load "track-scroll.el")

that's it.


The horizontal scrolling is partly implemented but it doesn't really work too well so I decided to not use it (but put the code there for anybody to look at)

Some aspects of this should be customizable.

Some modes (such as Info) override the definition of mouse button2 and then the simple scrolling doesn't work anymore. The control-scrolling still does.