Emacs and the mouse wheel
Peter Schwenke
peter at bluetoad.com.au
Thu Oct 27 02:34:50 UTC 2005
Jhair Tocancipa Triana wrote:
> Dan Monjar writes:
>
>
>>Using Breezy... anyone know how to get Emacs and the mouse wheel to work
>>together? I like to vertical scroll in Emacs as I do everywhere else on
>>the system.
>
>
> I do have the following in my .emacs:
>
> ,----
> | ; Enable mouse wheel mode
> | (mouse-wheel-mode t)
> `----
>
> It works with the default Emacs in Breezy, without downloading any
> additional packages.
>
The following behaves nicely for me in Hoary and Breezy. By default it
scrolls half a page for each graduation on the wheel. With the shift
key pressed you can go up/down 1 line for each graduation on the mouse.
With the ctrl-key pressed you go 1 page.
...Peter
;;; ====== mouse wheel ====
(defun up-slightly () (interactive) (scroll-up 5))
(defun down-slightly () (interactive) (scroll-down 5))
(global-set-key [mouse-4] 'down-slightly)
(global-set-key [mouse-5] 'up-slightly)
(defun up-one () (interactive) (scroll-up 1))
(defun down-one () (interactive) (scroll-down 1))
(global-set-key [S-mouse-4] 'down-one)
(global-set-key [S-mouse-5] 'up-one)
(defun up-a-lot () (interactive) (scroll-up))
(defun down-a-lot () (interactive) (scroll-down))
(global-set-key [C-mouse-4] 'down-a-lot)
(global-set-key [C-mouse-5] 'up-a-lot)
(defun scroll-up-half ()
"Scroll up half a page."
(interactive)
(scroll-up (/ (window-height) 2))
)
(defun scroll-down-half ()
"Scroll down half a page."
(interactive)
(scroll-down (/ (window-height) 2))
)
(global-set-key [(mouse-5)] 'scroll-up-half)
(global-set-key [(mouse-4)] 'scroll-down-half)
More information about the ubuntu-users
mailing list