manpagez: man pages & more
info emacs
Home | html | info | man
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

13. Killing and Moving Text

Killing means erasing text and copying it into the kill ring, from which you can bring it back into the buffer by yanking it. (Some systems use the terms “cutting” and “pasting” for these operations.) This is the most common way of moving or copying text within Emacs. Killing and yanking is very safe because Emacs remembers several recent kills, not just the last one. It is versatile, because the many commands for killing syntactic units can also be used for moving those units. But there are other ways of copying text for special purposes.

Most commands which erase text from the buffer save it in the kill ring. These commands are known as kill commands. The commands that erase text but do not save it in the kill ring are known as delete commands. The C-x u (undo) command (see section Undo) can undo both kill and delete commands; the importance of the kill ring is that you can also yank the text in a different place or places. Emacs has only one kill ring for all buffers, so you can kill text in one buffer and yank it in another buffer.

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 erase 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.

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. Therefore, 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. Normally, kill commands beep and display an error message when this happens. But if you set the variable kill-read-only-ok to a non-nil value, they just print a message in the echo area to explain why the text has not been erased.

You can also use the mouse to kill and yank. See section Killing and Yanking on Graphical Displays.

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]
© 2000-2024
Individual documents may contain additional copyright information.