Bug 19699 - Mousewheel support in GNU emacs 20.7
Summary: Mousewheel support in GNU emacs 20.7
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: emacs
Version: 7.0
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Trond Eivind Glomsrxd
QA Contact: Aaron Brown
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-10-24 17:14 UTC by Omnifarious
Modified: 2007-04-18 16:29 UTC (History)
0 users

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2000-10-24 19:11:48 UTC
Embargoed:


Attachments (Terms of Use)

Description Omnifarious 2000-10-24 17:14:38 UTC
Here is some code that could be added to mouse.el to accomplish this:

---------------------------------------------------------
(defcustom mouse-wheel-distance 10
  "*Number of lines, maximum, to scroll the window when you move the mouse
wheel."
  :type 'integer
  :group 'mouse)

;--------------------------

(defun mouse-wheelscroll-down ()
  " A function to scroll up or down in response to the mouse wheel."
  (interactive)
  (scroll-down
   (min mouse-wheel-distance
        (max 1 (- (window-height)
                  next-screen-context-lines)))))
;--------------------------

(defun mouse-wheelscroll-up ()
  " A function to scroll up or down in response to the mouse wheel."
  (interactive)
  (scroll-up
   (min mouse-wheel-distance
         (max 1 (- (window-height)
                   next-screen-context-lines)))))

(global-set-key [mouse-4] (function mouse-wheelscroll-down))
(global-set-key [mouse-5] (function mouse-wheelscroll-up))
---------------------------------------------------------

Perhaps it would be better to use a scaling factor against (window-height)
rather than an absolute distance for mouse-wheel-distance.

Comment 1 Trond Eivind Glomsrxd 2000-10-24 19:11:45 UTC
I think adding mwheel.el is a better solution - I'll probably do that.

Comment 2 Trond Eivind Glomsrxd 2000-12-11 03:23:16 UTC
Done, in emacs-20.7-22 and higher, coming soon to a Rawhide mirror near you.


Note You need to log in before you can comment on or make changes to this bug.