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.
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;
which is usually bound to M-y; and
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-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
repetitively for each
yank-handler segment. In turn,
insert-for-yank-1 strips text properties from the inserted text
yank-excluded-properties. Otherwise, it is just
insert. We will stick with plain
insert since it
is easier to understand.)
To begin to understand how
yank-pop work, it is
first necessary to look at the