Next: , Previous: , Up: Yanking   [Contents][Index]

9.5.2 Appending Kills

Normally, each kill command pushes a new block onto the kill ring. However, two or more kill commands in a row combine their text into a single entry, so that a single C-y yanks it all back. This means you don’t have to kill all the text you want to yank in one command; you can kill line after line, or word after word, until you have killed what you want, then get it all back at once using C-y. (Thus we join television in leading people to kill thoughtlessly.)

Commands that kill forward from point add onto the end of the previous killed text. Commands that kill backward from point add onto the beginning. This way, any sequence of mixed forward and backward kill commands puts all the killed text into one entry without rearrangement. Numeric arguments do not break the sequence of appending kills. For example, suppose the buffer contains:

This is the first
line of sample text
and here is the third.

with point at the beginning of the second line. If you type C-k C-u 2 M-DEL C-k, the first C-k kills the text ‘line of sample text’, C-u 2 M-DEL kills ‘the first’ with the newline that followed it, and the second C-k kills the newline after the second line. The result is that the buffer contains ‘This is and here is the third.’ and a single kill entry contains ‘the firstRETline of sample textRET’—all the killed text, in its original order.

If a kill command is separated from the last kill command by other commands (not just numeric arguments), it starts a new entry on the kill ring. To force a kill command to append, first type the command C-M-w (append-next-kill). C-M-w tells the following command, if it is a kill command, to append the text it kills to the last killed text, instead of starting a new entry. With C-M-w, you can kill several separated pieces of text and accumulate them to be yanked back in one place.

Next: , Previous: , Up: Yanking   [Contents][Index]