Emacs/emacs/Erasing
Next: Basic Undo, Previous: Moving Point, Up: Basic [Contents][Index]
7.3 Erasing Text
- DEL
BACKSPACE
- Delete the character before point, or the region if it is active (
delete-backward-char
). - Delete
- Delete the character after point, or the region if it is active (
delete-forward-char
). - C-d
- Delete the character after point (
delete-char
). - C-k
- Kill to the end of the line (
kill-line
). - M-d
- Kill forward to the end of the next word (
kill-word
). - M-DEL
M-BACKSPACE
- Kill back to the beginning of the previous word (
backward-kill-word
).
The DEL (delete-backward-char
) command removes
the character before point, moving the cursor and the characters after
it backwards. If point was at the beginning of a line, this deletes
the preceding newline, joining this line to the previous one.
If, however, the region is active, DEL instead deletes the text in the region. See Mark, for a description of the region.
On most keyboards, DEL
is labeled BACKSPACE
, but we
refer to it as DEL
in this manual. (Do not confuse DEL
with the Delete
key; we will discuss Delete
momentarily.)
On some text terminals, Emacs may not recognize the DEL
key
properly. See DEL Does Not Delete, if you encounter this problem.
The Delete
(delete-forward-char
) command deletes in the
opposite direction: it deletes the character after point, i.e., the
character under the cursor. If point was at the end of a line, this
joins the following line onto this one. Like DEL, it
deletes the text in the region if the region is active (see Mark).
C-d (delete-char
) deletes the character after point,
similar to Delete
, but regardless of whether the region is
active.
See Deletion, for more detailed information about the above deletion commands.
C-k (kill-line
) erases (kills) a line at a time. If
you type C-k at the beginning or middle of a line, it kills all
the text up to the end of the line. If you type C-k at the end
of a line, it joins that line with the following line.
See Killing, for more information about C-k and related commands.
Next: Basic Undo, Previous: Moving Point, Up: Basic [Contents][Index]