Next: Drag and Drop, Previous: Pointer Shape, Up: Frames
The X server records a set of selections which permit transfer of data between application programs. The various selections are distinguished by selection types, represented in Emacs by symbols. X clients including Emacs can read or set the selection for any given type.
This function sets a “selection” in the X server. It takes two arguments: a selection type type, and the value to assign to it, data. 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.
Each possible type has its own selection value, which changes independently. The usual values of type are
PRIMARY,SECONDARYandCLIPBOARD; these are symbols with upper-case names, in accord with X Window System conventions. If type isnil, that stands forPRIMARY.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
PRIMARY.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
TEXT,STRING,UTF8_STRING,TARGETS,LENGTH,DELETE,FILE_NAME,CHARACTER_POSITION,NAME,LINE_NUMBER,COLUMN_NUMBER,OWNER_OS,HOST_NAME,USER,CLASS,ATOM, andINTEGER. (These are symbols with upper-case names in accord with X conventions.) The default for data-type isSTRING.
The X server also has a set of eight numbered cut buffers which can store text or other data being moved between applications. Cut buffers are considered obsolete, but Emacs supports them for the sake of X clients that still use them. Cut buffers are numbered from 0 to 7.
This function returns the contents of cut buffer number n. If omitted n defaults to 0.
This function stores string into the first cut buffer (cut buffer 0). If push is
nil, only the first cut buffer is changed. If push is non-nil, that says to move the values down through the series of cut buffers, much like the way successive kills in Emacs move down the kill ring. In other words, the previous value of the first cut buffer moves into the second cut buffer, and the second to the third, and so on through all eight cut buffers.
This variable specifies the coding system to use when reading and writing selections, the clipboard, or a cut buffer. 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-get-selection
and 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.
On Mac OS, selection-like data transfer between applications is
performed through a mechanism called scraps. The clipboard is a
particular scrap named com.apple.scrap.clipboard. Types of scrap
data are called scrap flavor types, which are identified by
four-char codes such as TEXT. Emacs associates a selection with
a scrap, and a selection type with a scrap flavor type via
mac-scrap-name and mac-ostype properties, respectively.
(get 'CLIPBOARD 'mac-scrap-name)
⇒ "com.apple.scrap.clipboard"
(get 'com.apple.traditional-mac-plain-text 'mac-ostype)
⇒ "TEXT"
Conventionally, selection types for scrap flavor types on Mac OS have
the form of UTI (Uniform Type Identifier) such as
com.apple.traditional-mac-plain-text,
public.utf16-plain-text, and public.file-url.
If this is non-
nil, the Emacs yank functions consult the clipboard before the primary selection, and the kill functions store in the clipboard as well as the primary selection. Otherwise they do not access the clipboard at all. The default isnilon most systems, button MS-Windows and Mac.
