In window systems, such as X, data can be transferred between different applications by means of selections. X defines an arbitrary number of selection types, each of which can store its own data; however, only three are commonly used: the clipboard, primary selection, and secondary selection. Other window systems support only the clipboard. See Cut and Paste in The GNU Emacs Manual, for Emacs commands that make use of these selections. This section documents the low-level functions for reading and setting window-system selections.
This function sets a window-system selection. It takes two arguments: a selection type type, and the value to assign to it, data.
type should be a symbol; it is usually one of
CLIPBOARD. These are symbols with
upper-case names, in accord with X Window System conventions. If
nil, that stands for
If data is
nil, it means to clear out the selection.
Otherwise, data may be a string, a symbol, an integer (or a cons
of two integers or list of two integers), an overlay, or a cons of two
markers pointing to the same buffer. An overlay or a pair of markers
stands for text in the overlay or between the markers. The argument
data may also be a vector of valid non-vector selection values.
This function returns data.
gui-get-selection&optional type data-type
This function accesses selections set up by Emacs or by other
programs. It takes two optional arguments, type and
data-type. The default for type, the selection type, is
The data-type argument specifies the form of data conversion to
use, to convert the raw data obtained from another program into Lisp
data. Meaningful values include
INTEGER. (These are symbols with upper-case names in accord
with X conventions.) The default for data-type is
STRING. Window systems other than X usually support only a
small subset of these types, in addition to
This variable specifies the coding system to use when reading and
writing selections or the clipboard. See Coding Systems. The default is
converts to the text representation that X11 normally uses.
When Emacs runs on MS-Windows, it does not implement X selections in
general, but it does support the clipboard.
gui-set-selection on MS-Windows support the text data type
only; if the clipboard holds other types of data, Emacs treats the
clipboard as empty. The supported data type is
For backward compatibility, there are obsolete aliases
x-set-selection, which were the