Text is selected by setting a mark to start the area being selected, called a region by EMACS, then navigating to the other end of the selection.
|Sets the mark. This is the start of the region. Use the movement keystrokes (like arrows) to define the end of the region.|
|Marks the paragraph|
|Mark the buffer|
The kill ring would be known as a buffer or clipboard in other applications, or the OS system-wide clipboard. A key difference is it will hold up to 30 items.
|Kill region–removes text from buffer and places it in the kill ring. A “cut” in contemporary language.|
|Copy region, leaving the selected region in place. A “copy” in contemporary language.|
|Yank–inserts the most recent text put into the kill ring at the current location of the cursor.|
|Yank-Pop–Yanks further down the kill ring, replacing the text previously inserted.|
Suppose you copy three lines of text separately into the kill ring, in this order:
One Two Three
(This is to say you mark
One and then copy it, then mark
Two and copy it, and finally
Three (as opposed to selecting all as one region).)
Three is now in the top (“most recent”) slot in the kill ring, followed by
I want to insert from the kill ring into this sentence:
This is item number in the kill ring.
Note there are two spaces between “number” and “in.” If the cursor were placed on the second of those two spaces, any text inserted (typed or yanked) would go between the spaces. If the
yank command were invoked (
), you would get:
This is item number Three in the kill ring.
If I then invoke
), I would get:
This is item number Two in the kill ring.
(The sequence would be
yank-pop again, and I get:
This is item number One in the kill ring.
This can continue up to thirty times.
Note that each time
yank-pop is invoked, the most recent thing yanked becomes the most top item kill ring–everything before that is removed from the kill ring. To get to
One in the example above, I hit
. If I type some more and do a
) command, I get “One” inserted. If I were to do
, it would provide whatever was put in the kill ring before “One.” This can be overridden by setting an argument before the
yank command (so,
would take you back to the top item in the kill-ring, "Three").
In practice, I usually am only pasting the most recent thing from the kill ring, similar to the system clipboard. Occasionally, going back one happens, but it doesn’t help alternating between text (saying I want to put
</tag> on either side of a bunch of things).
Anything copied from another application to the system clipboard becomes the most recent thing in the kill ring.
The last thing copied to the kill ring also is copied to the system clipboard. Any changes due to
yank-pop are not reflected. In the example above, even though the series of
yank-pops made the top item in the kill ring “One”, the system clipboard will have “Three”, as that was the last thing copied to the kill ring.
Return to Reference IndexCreated by I. Charles Barilleaux