User Tools

Site Tools


emacs:emacs

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
emacs:emacs [2008/12/02 14:24] decianmemacs: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 <code>
 +ctrl-x r k
 +</code>, which will cut out the rectangular region.
 +Paste the rectangular region with 
 +<code>
 +ctrl-x r y
 +</code>
 +==== Search for a string ====
 +If you want to search for a string, type
 +<code>
 +ctrl-s
 +</code>
 +If you want to search the same string as before, press:
 +<code>
 +ctrl-s ctrl-s
 +</code>
 +
 ===== Configuring Emacs===== ===== Configuring Emacs=====
 ==== Mousewheel on lxplus ==== ==== Mousewheel on lxplus ====
Line 26: Line 45:
 ) )
  
-;; ====== set mouse wheel to scrolling function ====== +;; ====== set mouse wheel to scrolling function  
-;; ====== press shift + (mousewheel) for slow scrolling and ====== +;; ====== press shift + (mousewheel) for slow scrolling and  
-;; ====== ctrl + (mousewheel) for fast scrolling ======+;; ====== ctrl + (mousewheel) for fast scrolling 
 (global-set-key [(mouse-5)] 'up-slightly) (global-set-key [(mouse-5)] 'up-slightly)
 (global-set-key [(mouse-4)] 'down-slightly) (global-set-key [(mouse-4)] 'down-slightly)
Line 37: Line 56:
  
 </code> </code>
-The first four blocks of code define function for different scrolling speeds. The lines+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 when using emacs in the LHCb environment on lxplus. If you want the standard numberpad, add the following to the ''~/.emacs'' file:
 +<code>
 +(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"))
 +)
 +</code>
 +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.)
 +
 +==== Adding goto-line ====
 +A useful little command when coding with emacs is **goto-line**. To assign it a shortcut, add in your ''~/.emacs'': 
 +<code>
 +;; == goto line ==
 +(define-key global-map "\C-xg" 'goto-line)
 +</code>
 +Goto-line then is executed with ''ctrl-x g''.
 +
 +==== Changing the font permanently ====
 +To permanently change the font in emacs, do the following:
 +  * Type ''xfontsel'' in a terminal. A window will appear. Choose your desired font by selecting ''fndry'', ''fmly'', etc. You will end up with a string that exactely describes your font.
 +  * Start emacs and go to the *scratch* buffer. Type: ''prin1-to-string (x-list-fonts "font-you-whant-to-check or pattern"))'' where you put in the selected font from xfontsel. Place the cursor after the last closing parenthesis and type CTRL-j. A list of available fonts with the given pattern will appear.
 +  * Open your .emacs file and add the following line: 
 +<code>
 +(set-default-font "the font you want to choose")
 +</code>
 +for example
 +<code>
 +(set-default-font "-adobe-courier-medium-r-normal--12-120-75-75-m-70-iso8859-10")
 +</code>
 +  * Close emacs and restart it. Your default font should now be set to the font you chose.
emacs/emacs.1228224269.txt.gz · Last modified: 2008/12/02 14:24 by decianm