Basic Emacs


Although emacs has sophisticated features, the basics are easy to learn. Ordinary characters that are typed are put directly into the text. Commands to emacs are given by control characters (denoted C-) and Meta characters (denoted M-). For example, C-f would be entered by holding down the Ctrl key while typing f. On many workstations, Meta is Alt . Cursor positioning can be done with arrow keys or the left mouse button. Documentation and options can be found in menus at top of screen.

C-f Move the cursor Forward one character.
C-b Move the cursor Backward one character.
C-p Move up to the Previous line.
C-n Move down to the Next line.
C-a Move cursor to beginning of line.
C-e Move cursor to End of line.
M-f Move the cursor Forward one word.
M-b Move the cursor Backward one word.
C-v Move forward down the text by a screenful.
M-v Move backwards up the text by a screenful.
C-l Center the display around the cursor position.
M-< Go to the beginning of the file.
M-> Go to the end of the file.
C-d Delete a character.
M-d Delete a word (saved: see C-y).
C-k Kill to end of line. Two individual C-k's delete a line
and its carriage return. (saved: see C-y.)
C-y Yank back what was killed earlier. Material can be duplicated
by yanking it back multiple times. A single line can be yanked
at the Lisp interpreter prompt and executed by a carriage return.
C-u n Repeat the next command n times. For example, C-u 6 C-k C-y C-y
will kill six lines (including the carriage returns) and make two copies.
C-s str Search for the string str. When found, enter ESCape to get
out of search mode. If you want the next or previous
occurrence of str, just enter C-s or C-r again.
C-r str Reverse search for str .
C-x C-v Visit a new file; EMACS will prompt for the file name.
C-x C-w Write out the text buffer to a file.
C-x C-s Save the text buffer in the file it came from.
C-g Abort the current command.
M-x run lisp Run Austin Kyoto Common Lisp with X underneath Emacs.
M-x fi:common-lisp Run Allegro Common Lisp underneath Emacs.
C-x 5 Split the screen in half vertically to make two windows.
C-x 2 Split the screen in half horizontally to make two windows.
C-M-z Evaluate the form under the cursor from Lisp.
C-x C-c Stop Emacs.