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. In the second part, the mousewheel is assigned to a scrolling speed. Pressing shift oder ctrl while scrolling will alter the speed.

Numberpad on lxplus

By default, the keys on the numberpad are overloaded with different functionalities by loading a LHCb specific configuration file. If you want the standard numberpad, add the following to the ~/.emacs file:

(defun setnumpad()
  (interactive)
  (global-set-key [kp-decimal] '".")
  (global-set-key [kp-subtract] '"-")
  (global-set-key [kp-enter] '"\C-q \C-j")
  (global-set-key [kp-0]   '"0")
  (global-set-key [kp-1]   '"1")
  (global-set-key [kp-2]   '"2")
  (global-set-key [kp-3]   '"3")
  (global-set-key [kp-4]   '"4")
  (global-set-key [kp-5]   '"5")
  (global-set-key [kp-6]   '"6")
  (global-set-key [kp-7]   '"7")
  (global-set-key [kp-8]   '"8")
  (global-set-key [kp-9]   '"9")
 )

(defun setnonumpad()
  (interactive)
  (load (expand-file-name "$EMACSDIR/edt"))
)

After emacs has started, type alt-x setnumpad to activate the normal numberpad. If you want to deactivate it, type alt-x setnumpad. Note: This is not very sophisticated, as just the configuration file is loaded again.

emacs/emacs.1228224762.txt.gz · Last modified: 2008/12/02 14:32 by decianm