GNU EMACS

GNU emacs is very important to master.   It is available on almost every UNIX system and most other editors have emacs emulation.  It is also a development environment.  By this, I mean that you can edit a program, compile it and run it without ever leaving emacs.  You can also get emacs for PCs.

GNU emacs comes in a few flavors.  At the college, the version you can use through telnet is named "emacs: and the one through X-windows is "xemacs".  They are both the same executable with different flags set.  You can create a configuration file to customize the way that it works.  I have a useful one in the notes.  The configuration file uses Lisp to describe the way we want the editor to work.  Some of these commands assume that we are using my configuration file.

To Invoke Emacs

emacs [filename]     (You can actually have a list of files names here.

Cursor Movement

Arrow keys may be used to control the cursor position.  I list alternatives in case the compute you are using does not understand your arrow keys.

^p   up one line                                         ^n   down one line
^f    to the right one space                         ^b    back one space
^a   beginning of line                                  ^e    end of line
^v   Forward one page                              ^z    back one page
esc <   beginning of file                              esc >   end of file
^xl  give line no. (sort of)                           esc g   go to line no.

File and buffer manipulation

^x^f   Read in a file.                                  ^x b   access buffer
^x 2   Split the screen                               ^x 1   show current pane
^x 0 show other pane                               ^xo    Move cursor to other pane
^x ^b display buffer names                        ^x^c  save and quit

Text Manipulation

^d   Delete next character                        esc d   Delete next word
^k   Delete line from cursor                      esc <blank>   Set mark
^x^u  marked area to upper case.            ^x^l   marked area to lower case
^y   recall last data deleted.                      ^r   incremental search backwards
esc r query replace                                   ^s  incremental  search forward
^w Delete between cursor and mark
esc w Copy between cursor and mark

Special Commands

^g   Cancel command                             esc x  Execute a function (Shell, man, gdb, etc)
esc s  Run make file                                esc n Parse error message
^xc  Stop emacs, run shell fg restart emacs
^x?  Help                                               ^xd   directory listing
^xm   Create mail                                   ^c^c  Send mail

esc x gdb Run gnu debugger from emacs

tabs may be used to fill in remainder of data typed. For example, if emacs prompts for file name, type the first few characters and hitting tab will fill in the remaining characters.