Mouse scroll with Emacs
di Lorenzo Clementi |
Commenti |
Tempo di lettura: 0 - 1 min
Picture the scene: you have just completed the installation of your brand new Ubuntu Linux. Now, you download and install Emacs and you are ready to start developing a great application. It is then when you realize that you cannot scroll up and down the page using the mouse wheel. How to fix this problem? Just add the code below to the .emacs file in your home folder and that's it!
(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)
Save and restart Emacs.