In the X window system, 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. See Cut and Paste, for Emacs commands that make use of these selections. This section documents the low-level functions for reading and setting X selections.
This function sets an X 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 type is
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.
This function accesses selections set up by Emacs or by other X clients. 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 X client 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
This variable specifies the coding system to use when reading and writing selections or the clipboard. See Coding Systems. The default is
compound-text-with-extensions, which 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.
x-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.