User Tools

Site Tools


emacs:emacs

This is an old revision of the document!


Emacs

Configuring Emacs

Mousewheel on lxplus

If you use emacs on lxplus, the mousewheel isn't enabled. To add this functionality, open your ~/.emacs file and write in the following lines:

;; ====== mouse wheel ====
;; ====== define scrolling functions ======
(defun up-slightly () (interactive) (scroll-up 5))
(defun down-slightly () (interactive) (scroll-down 5))

(defun up-one () (interactive) (scroll-up 1))
(defun down-one () (interactive) (scroll-down 1))

(defun up-a-lot () (interactive) (scroll-up))
(defun down-a-lot () (interactive) (scroll-down))

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

;; ====== set mouse wheel to scrolling function ======
;; ====== press shift + (mousewheel) for slow scrolling and ======
;; ====== ctrl + (mousewheel) for fast scrolling ======
(global-set-key [(mouse-5)] 'up-slightly)
(global-set-key [(mouse-4)] 'down-slightly)
(global-set-key [S-mouse-4] 'down-one)
(global-set-key [S-mouse-5] 'up-one)
(global-set-key [C-mouse-4] 'down-a-lot)
(global-set-key [C-mouse-5] 'up-a-lot)

The first four blocks of code define function for different scrolling speeds. The lines

emacs/emacs.1228224248.txt.gz · Last modified: 2008/12/02 14:24 by decianm