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


10.1 Kill Ring Overview

The kill ring is a list of textual strings. This is what it looks like:

("some text" "a different piece of text" "yet more text")

If this were the contents of my kill ring and I pressed C-y, the string of characters saying ‘some text’ would be inserted in this buffer where my cursor is located.

The yank command is also used for duplicating text by copying it. The copied text is not cut from the buffer, but a copy of it is put on the kill ring and is inserted by yanking it back.

Three functions are used for bringing text back from the kill ring: yank, which is usually bound to C-y; yank-pop, which is usually bound to M-y; and rotate-yank-pointer, which is used by the two other functions.

These functions refer to the kill ring through a variable called the kill-ring-yank-pointer. Indeed, the insertion code for both the yank and yank-pop functions is:

(insert (car kill-ring-yank-pointer))

(Well, no more. In GNU Emacs 22, the function has been replaced by insert-for-yank which calls insert-for-yank-1 repetitively for each yank-handler segment. In turn, insert-for-yank-1 strips text properties from the inserted text according to yank-excluded-properties. Otherwise, it is just like insert. We will stick with plain insert since it is easier to understand.)

To begin to understand how yank and yank-pop work, it is first necessary to look at the kill-ring-yank-pointer variable.

This page has generated for branch:work/add_lispintr, commit:65845cf60c073f2f3182d1d07483530e9bbe1d96 to check Japanese translation.