[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

H.7 Deletion and Killing

Most commands which erase text from the buffer save it in the kill ring so that you can move or copy it to other parts of the buffer. These commands are known as kill commands. The rest of the commands that erase text do not save it in the kill ring; they are known as delete commands. (This distinction is made only for erasure of text in the buffer.) If you do a kill or delete command by mistake, you can use the C-x u (undo) command to undo it (see section D.4 Undoing Changes).

You cannot kill read-only text, since such text does not allow any kind of modification. But some users like to use the kill commands to copy read-only text into the kill ring, without actually changing it. If you set the variable kill-read-only-ok to a non-nil value, the kill commands work specially in a read-only buffer: they move over text, and copy it to the kill ring, without actually deleting it from the buffer. When this happens, a message in the echo area tells you what is happening.

The delete commands include C-d (delete-char) and DEL (delete-backward-char), which delete only one character at a time, and those commands that delete only spaces or newlines. Commands that can destroy significant amounts of nontrivial data generally do a kill operation instead. The commands' names and individual descriptions use the words `kill' and `delete' to say which kind of operation they perform.

Many window systems follow the convention that insertion while text is selected deletes the selected text. You can make Emacs behave this way by enabling Delete Selection mode, with M-x delete-selection-mode, or using Custom. Another effect of this mode is that DEL, C-d and some other keys, when a selection exists, will kill the whole selection. It also enables Transient Mark mode (see section H.2 Transient Mark Mode).

H.7.1 Deletion  Commands for deleting small amounts of text and blank areas.
H.7.2 Killing by Lines  How to kill entire lines of text at one time.
H.7.3 Other Kill Commands  Commands to kill large regions of text and syntactic units such as words and sentences.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on April 2, 2002 using texi2html