Emacs Quick Reference Guide
DEL is the DELETE key and ESC is the escape key (key F11 in G17)
C – <chr> means hold the CONTROL key while typing the character <chr>
M – <chr> means hold the ESC key down and type <chr>
Manipulating Files
Exit an emacs window permanently C – x C – c Read (an existing) file into emacs C – x C – f Save a file back to disc C – x C – s Insert contents of another file into this buffer C – x i write a buffer to a specified file C – x C – w
Note that for the write command, the file is inserted at the cursor position.
Working within a File
Moving around: one character at a time, use arrow keys.
Scrolling to next screen C – v Scrolling to previous screen M – v Go to buffer beginning or end M – < M – >
Killing and deleting
| Entity to kill | backward | forward |
| Character | DEL | C – d |
| word | M – DEL | M – d |
| to end of line | M – 0 C – k | C – k |
| sentence | C – x DEL | M – k |
| Kill to next occurence of char | M – z | char |
Error recovery
| Abort partially typed or executing command | C – g |
| Undo an unwanted change | C – x u or C – _ |
| Restore a buffer to its original contents | M – x revert – buffer |
| Redraw garbaged screen | C – l |
The latter command is not only useful to redraw the screen, it also centers the screen so that the cursor is placed in the midddle of the window.
Searching:
| search forward | C – s |
| search backward | C – r |
| regular expression search | C – M – s |
| exit incremental search | ESC |
| undo effect of last character | DEL |
| abort current search | C – g |
Starting EMACS
First, make sure you are in the right sub-directory by issuing the command
> cd directory
where directory is the sub-directory you will be working on (e.g. project 1 or project 2). Once in the appropriate directory, it is a matter of creating or updating a file by the command:
> emacs answer &
This creates a window and reads the file answer if it exists; otherwise it will create the file when you save the contents of the emacs window. The & tells the system to run emacs in the background so it doesn’t lock up the xterm window.