This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
emacs:emacs [2008/12/02 14:19] – created decianm | emacs:emacs [2009/05/08 11:45] (current) – decianm | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Emacs ====== | ====== Emacs ====== | ||
+ | ===== Good to know ===== | ||
+ | ==== Cutting out a rectangle ==== | ||
+ | To cut out a rectangle in emacs, mark the region in question with your mouse (upper left to lower right). Then press < | ||
+ | ctrl-x r k | ||
+ | </ | ||
+ | Paste the rectangular region with | ||
+ | < | ||
+ | ctrl-x r y | ||
+ | </ | ||
+ | ==== Search for a string ==== | ||
+ | If you want to search for a string, type | ||
+ | < | ||
+ | ctrl-s | ||
+ | </ | ||
+ | If you want to search the same string as before, press: | ||
+ | < | ||
+ | ctrl-s ctrl-s | ||
+ | </ | ||
+ | |||
===== Configuring Emacs===== | ===== Configuring Emacs===== | ||
==== Mousewheel on lxplus ==== | ==== Mousewheel on lxplus ==== | ||
If you use emacs on lxplus, the mousewheel isn't enabled. To add this functionality, | If you use emacs on lxplus, the mousewheel isn't enabled. To add this functionality, | ||
< | < | ||
+ | ;; ====== mouse wheel | ||
+ | ;; ====== define scrolling functions | ||
(defun up-slightly () (interactive) (scroll-up 5)) | (defun up-slightly () (interactive) (scroll-up 5)) | ||
(defun down-slightly () (interactive) (scroll-down 5)) | (defun down-slightly () (interactive) (scroll-down 5)) | ||
Line 24: | Line 45: | ||
) | ) | ||
+ | ;; ====== set mouse wheel to scrolling function | ||
+ | ;; ====== press shift + (mousewheel) for slow scrolling and | ||
+ | ;; ====== ctrl + (mousewheel) for fast scrolling | ||
(global-set-key [(mouse-5)] ' | (global-set-key [(mouse-5)] ' | ||
(global-set-key [(mouse-4)] ' | (global-set-key [(mouse-4)] ' | ||
Line 32: | Line 56: | ||
</ | </ | ||
+ | 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 '' | ||
+ | ==== Numberpad on lxplus ==== | ||
+ | By default, the keys on the numberpad are overloaded with different functionalities when using emacs in the LHCb environment on lxplus. If you want the standard numberpad, add the following to the '' | ||
+ | < | ||
+ | (defun setnumpad() | ||
+ | (interactive) | ||
+ | (global-set-key [kp-decimal] '" | ||
+ | (global-set-key [kp-subtract] '" | ||
+ | (global-set-key [kp-enter] '" | ||
+ | (global-set-key [kp-0] | ||
+ | (global-set-key [kp-1] | ||
+ | (global-set-key [kp-2] | ||
+ | (global-set-key [kp-3] | ||
+ | (global-set-key [kp-4] | ||
+ | (global-set-key [kp-5] | ||
+ | (global-set-key [kp-6] | ||
+ | (global-set-key [kp-7] | ||
+ | (global-set-key [kp-8] | ||
+ | (global-set-key [kp-9] | ||
+ | ) | ||
+ | (defun setnonumpad() | ||
+ | (interactive) | ||
+ | (load (expand-file-name " | ||
+ | ) | ||
+ | </ | ||
+ | After emacs has started, type '' | ||
+ | |||
+ | ==== Adding goto-line ==== | ||
+ | A useful little command when coding with emacs is **goto-line**. To assign it a shortcut, add in your '' | ||
+ | < | ||
+ | ;; == goto line == | ||
+ | (define-key global-map " | ||
+ | </ | ||
+ | Goto-line then is executed with '' | ||
+ | |||
+ | ==== Changing the font permanently ==== | ||
+ | To permanently change the font in emacs, do the following: | ||
+ | * Type '' | ||
+ | * Start emacs and go to the *scratch* buffer. Type: '' | ||
+ | * Open your .emacs file and add the following line: | ||
+ | < | ||
+ | (set-default-font "the font you want to choose" | ||
+ | </ | ||
+ | for example | ||
+ | < | ||
+ | (set-default-font " | ||
+ | </ | ||
+ | * Close emacs and restart it. Your default font should now be set to the font you chose. |