bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Suggestions for mouse wheel support in mouse.el


From: Eric M. Hopper
Subject: Suggestions for mouse wheel support in mouse.el
Date: Tue, 24 Oct 2000 12:16:48 -0500
User-agent: Mutt/1.2.5i

        This is probably a naive way of doing this, but, hopefully, it
should be a starting point for mouse wheel support in emacs.

---------------------------------------------------------
(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.

Thanks,
-- 
The best we can hope for concerning the people at large is that they
be properly armed.  -- Alexander Hamilton
-- Eric Hopper (hopper@omnifarious.mn.org http://www.omnifarious.org/~hopper) --

Attachment: pgpNzgVKk5sei.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]