13.2 Killing by Lines
- C-k
- Kill rest of line or one or more lines (
kill-line
).
- C-S-backspace
- Kill an entire line at once (
kill-whole-line
)
The simplest kill command is C-k. If given at the beginning of
a line, it kills all the text on the line, leaving it blank. When used
on a blank line, it kills the whole line including its newline. To kill
an entire non-blank line, go to the beginning and type C-k twice.
More generally, C-k kills from point up to the end of the line,
unless it is at the end of a line. In that case it kills the newline
following point, thus merging the next line into the current one.
Spaces and tabs that you can't see at the end of the line are ignored
when deciding which case applies, so if point appears to be at the end
of the line, you can be sure C-k will kill the newline.
When C-k is given a positive argument, it kills that many lines
and the newlines that follow them (however, text on the current line
before point is not killed). With a negative argument −n, it
kills n lines preceding the current line (together with the text
on the current line before point). Thus, C-u - 2 C-k at the front
of a line kills the two previous lines.
C-k with an argument of zero kills the text before point on the
current line.
If the variable kill-whole-line
is non-nil
, C-k at
the very beginning of a line kills the entire line including the
following newline. This variable is normally nil
.
C-S-backspace (kill-whole-line
) will kill a whole line
including its newline regardless of the position of point within the
line. Note that many character terminals will prevent you from typing
the key sequence C-S-backspace.