(defvar ls6-mouse-wheel-increment 1
"*Scroll this many lines on scroll wheel movement.")
(defun ls6-mouse-wheel-scroll-down ()
"Scroll down on mouse-wheel action.
See variable `ls6-mouse-wheel-increment'."
(interactive)
(condition-case nil
(scroll-down ls6-mouse-wheel-increment)
(beginning-of-buffer nil)
(end-of-buffer nil)))
(defun ls6-mouse-wheel-scroll-up ()
"Scroll up on mouse wheel action.
See variable `ls6-mouse-wheel-increment'."
(interactive)
(condition-case nil
(scroll-up ls6-mouse-wheel-increment)
(beginning-of-buffer nil)
(end-of-buffer nil)))
(defun ls6-mouse-wheel-mode ()
"Enable scrolling on mouse wheel."
(interactive)
(global-set-key (kbd "<mouse-4>") 'ls6-mouse-wheel-scroll-up)
(global-set-key (kbd "<mouse-5>") 'ls6-mouse-wheel-scroll-down))
(ls6-mouse-wheel-mode).