X Selections, Cut Buffers, and Kill Rings. © 1997, 2002 by Jamie
Zawinski <jwz@jwz.org>  This document began as a description of
how Emacs and XEmacs deal with copying and pasting text under
X11. However, I've noticed that a lot of people are being
referred here to answer more general questions of how copying
and pasting work under X, or, more specifically, how they should
implement copying and pasting in their own X applications. So
allow me to summarize...   X11 has these things called
``selections.'' They have names. There are really only two you
need to know about: the Primary selection and the Clipboard
selection. An application is said to ``own'' a selection when it
raises its hand and says, ``I have the Primary selection now.''
Only one application can own a selection at a time, so when one
app asserts selection ownership, the previous owner loses it.
Asserting ownership of a selection doesn't actually transfer
data. When you want to copy text from application A to
application B, it goes like this:  X