Home Computing DAQ E-mail Notes Meetings Subsystems Search

This page is a short introduction to emacs in LHCb. It gives the basics for beginners of emacs, a description of the LHCb specific components, and some tips to better use emacs. The complete emacs manual is available from the GNU Emacs website

Starting with emacs

While logged-in on lxplus, you should copy the LHCb default configuration file to your home directory :  cp $EMACSDIR/.emacs    ~/.emacs and then you just type emacs at the prompt. A new window pops up, and you see the LHCb emacs welcome, with the list of changes in the last releases. Note that you can specify a file to edit, like emacs test.cpp, or start emacs as detached process with emacs &.

An introduction to the LHCb customization of emacs was given in a talk by S.Ponce.

LHCb-emacs works nicely with a standard VT200 keyboard, using a PC keyboard is less well tuned, work is in progress...

emacs has many, many features, and uses a lot of key bindings. A key can be used alone (x), together with Ctrl (C-x), with Alt (M-x), with Shift (S-x) or in a sequence of keys, for example kp-f1 (labeled PF1) is the Gold key, kp-f1 x gives yet another   function to the key x, usually another function key. Commands can also be type in plain text after the Do (M-x) key, and the list of possible completion is displayed when you type Return. This is a nice way to see what is possible. And emacs is smart enough to indicate which key can invoke this command! Another way to input commands is the menu,Buffers and Files is what you will use first.

Here is a list of the keys of some very handy commands.

C-x C-c Exits emacs. You are  prompted for all the buffers not yet saved. A file #filename# is left in the directory, so that you can recover the file later.
C-x C-f Find a file, and put them in a new buffer. The default directory is the one of the current buffer.
C-x C-s or F17 Saves the current buffer to its default file.
C-x C-w Writes the current buffer to a file, to be specified
C-x C-b Displays the list of buffers. You can then select the one you want, or perform action, type ? in this buffer for help.
kp-f3 (this is the '3' on the numeric keypad) Move the cursor to the next window.
C-x 1 Selects a single window to display
C-h K Describes the function of a key (or sequence of keys). Sometimes cryptic, but gives an idea.
Help Displays a map of the keypad, with a short name for the commands

LHCb specific

Some tips to use best emacs

You can configure emacs by adding instructions in your .emacs file. These are Lisp statements, not always easy to handle. Cut and paste is usually the way to get them correct. The source files of the LHCb customization are in $EMACSDIR, with extension.el, feel free to look at them and suggest changes.

Debugging with emacs

emacs can be used as an interface to the gdb debugger. See GDB in Emacs TWiki

Your contribution to these tips is welcome, as your contribution to LHCb-emacs. Just send a mail.