Next: , Previous: , Up: Deletion and Killing   [Contents][Index]

12.1.2 Killing by Lines


Kill rest of line or one or more lines (kill-line).


Kill an entire line at once (kill-whole-line)

The simplest kill command is C-k (kill-line). If used at the end of a line, it kills the line-ending newline character, merging the next line into the current one (thus, a blank line is entirely removed). Otherwise, C-k kills all the text from point up to the end of the line; if point was originally at the beginning of the line, this leaves the line blank.

Spaces and tabs at the end of the line are ignored when deciding which case applies. As long as point is after the last visible character in the line, you can be sure that C-k will kill the newline. To kill an entire non-blank line, go to the beginning and type C-k twice.

In this context, “line” means a logical text line, not a screen line (see Continuation Lines).

When C-k is given a positive argument n, it kills n lines and the newlines that follow them (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. 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) kills a whole line including its newline, regardless of the position of point within the line. Note that many text terminals will prevent you from typing the key sequence C-S-backspace.

Next: , Previous: , Up: Deletion and Killing   [Contents][Index]