It should be noted that emacs is a text editor and not a word processor. It is thus good at manipulating text rather than formatting text for viewing. Documents written with emacs are usually intended as input to programs, as e.g. compilers. To format text to be comfortably readable by humans one may either use openoffice (a wysiwyg, "what you see is what you get"-editor similar to Microsoft Word) or the TeX/LaTeX system that performs typesetting based on a file with ordinary text mixed with control commands.
To start emacs type emacs & to a shell:
$ emacs & |
It is also possible to set up the GNOME system to start emacs by clicking some button, but the advantage of starting emacs from a shell is that one can make sure that it is started in the correct directory. It is also possible to give emacs a filename to edit on the command line.
As a first exercise you should change your prompt to "Your.Name$ ". To start emacs for editing .bashrc, write
$ emacs .bashrc &
Now move the cursor after the last line, and enter a line like:
export PS1="Albert.Einstein$ " |
Even though it is possible to use emacs from the menus, it is good to learn a few control sequences:
C-g Quit signal that cancels the current command.
C-x C-f Open a file.
C-x C-s Save the buffer to the file.
C-a move cursor to beginning of line.
C-e move cursor to end of line.
C-k delete from cursor to end of line.
C-s Incremental search that performs the search while you type the search string. Another C-s takes you to the next occurence of the same string.
C-r Reversed incremental search. (See above.)
C-x 2 Split current window into two windows, one above the other. Allows you to examine two buffers, or two locations in the same buffer at the same time.
C-x 1 Deletes other windows in the frame and makes the selected window the only one. Very convenient after the compile command.
C-Home Move to the beginning of the document.
C-End Move to the end of the document.
C-x C-c closes emacs.
emacs autmatically adjusts some of its behavior to the kind of document that is in the buffer. Each buffer is in one major mode at the time. The names of the chosen modes (both major and minor) are written within parenthesis at the line below the buffer itself.
C-mode is the mode that is automatically chosen when editing files ending with ".c". A pecularity in this mode is the automatic indentation.
<TAB> indents the current line.
C-c C-q indents the current function.
To copy or cut we first need to select a region. That is done by
placing the cursor with the left mouse button
moving the mouse with the left button pressed down
To cut away this part, either press C-w or press the Cut button on the toolbar.
To copy the marked region, position the mouse at the point for insertion and press the middle mouse button. The possibility to select a region with the left mouse button and copy that region with the middle button is not restricted to emacs, but is rather built into the X Window System. It therefore works in most programs that display text, e.g. also in the xterm and in mozilla.
If you would like to learn more about emacs, there is built in help about a lot of things. By selecting TUTORIAL from the Help-menu or by typing C-h t a tutorial is started.
emacs is also fully documented within the info system.