| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This chapter will introduce you to some basic editing commands. You
can also learn the basic editing commands by typing Control-h t
(help-with-tutorial OR by selecting Emacs Tutorial from the
Help menu on the menu bar. Most of the Emacs commands will use the
CONTROL key or the META key. The following abbreviations
will be used for the CONTROL and META key in this manual:
The following abbreviations will be used for some other keys:
| 3.1 Inserting Text | Insert text in Emacs by simply typing at the cursor position. | |
| 3.2 Moving Around | Moving Around the cursor in the buffer, | |
| 3.3 Erasing Text | Different commands for erasing text | |
| 3.4 Giving Numeric Arguments | Giving Numeric Arguments to commands | |
| 3.5 Undoing Changes | Undoing Changes made by mistake |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
To insert printing characters into the text you are editing, just type them. Emacs will automatically insert the characters that you type into the buffer at the cursor. The cursor moves forward, but if you prefer to have text characters replace (overwrite) existing text characters, you can enable the Overstrike option from the Options menu in the menu bar.
To delete text you have just inserted, use DEL. DEL deletes the character before the cursor (not the one that the cursor is on top of or under; that is the character after the cursor). The cursor and all characters after it move backwards. Therefore, if you type a printing character and then type DEL, they cancel out.
Unfortunately, computer and keyboard manufacturers differ over the name of the DEL key. This is the key at the far right of the row of keys containing the digits, usually immediately above the RET key. It is usually labelled "Backspace" or "Delete" or some abbreviation. Modern keyboards will often have another key labelled "Del" in the edit keypad (along with an "Ins" key and perhaps some others). This is not the DEL key referred to here. It usually deletes forward in Emacs.
To end a line and start typing a new one, type RET. On some keyboards, this key is labelled "Enter". This inserts a newline character in the buffer. If point is in the middle of a line, RET splits the line. Typing DEL when the cursor is at the beginning of a line rubs out the newline before the line, thus joining the line with the preceding line.
Emacs automatically splits lines when they become too long, if you turn on a special mode called Auto Fill mode. See section `Filling' in XEmacs User's Manual, for information on using Auto Fill mode.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following commands will allow you to move the cursor around the screen. The actual function names corresponding to these commands are given in parenthesis. You can also invoke these commands by typing M-x <function name>. You can do this for any command in XEmacs.
backward-char).
forward-char).
previous-line).
next-line).
beginning-of-line).
end-of-line).
forward-word).
backward-word).
beginning-of-buffer).
end-of-buffer).
Goto char: |
You should then type in a number right after the colon and hit the RETURN key again. After reading a number n this command will move the cursor to character number n. Position 1 is the beginning of the buffer. For example, if you type M-x goto-char RET 200 RET, then the cursor will move to the 200th character starting from the beginning of the buffer.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
delete-backward-char).
delete-char).
kill-line). If you kill the line by
mistake you can yank or `paste' it back by typing
C-y. See section 9.4 Moving Text, for more information on yanking.
kill-word).
backward-kill-word).
kill-sentence).
zap-to-char). To use
this command type M-z. You will see the following statement in the
echo area :
Zap to char: |
Type any char and press the RET key. For example, if you type `p' then the entire text starting from the position of the cursor until the first occurrence of `p' is killed.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Any Emacs command can be given a numeric argument. Some commands
interpret the argument as a repetition count. For example, if you want
to move forward ten characters, you could type C-f ten
times. However, a more efficient way to do this would be to give an
argument of ten to the key C-f (the command forward-char, move
forward one character). Negative arguments are also allowed. Often they tell
a command to move or act backwards. For example, if you want to move
down ten lines, type the following:
C-u 10 C-n |
M-10 C-n |
C-u -10 C-n |
M--10 C-n |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
When you are editing a buffer, you might type something by mistake. Emacs allows you to undo all changes you make to a buffer (but not more than 8000 characters). Each buffer in Emacs keeps a record of the changes made to it individually, so the undo command applies to the current buffer. There are two undo commands:
undo).
See section `Undoing Changes' in XEmacs User's Manual, for more information on undoing changes.
| [ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |