12.3.2 Cut and Paste with Other Window Applications
Under the X Window System, there exists a primary selection containing the last stretch of text selected in an X application (usually by dragging the mouse). Typically, this text can be inserted into other X applications by mouse-2
clicks. The primary selection is separate from the clipboard. Its contents are more fragile; they are overwritten each time you select text with the mouse, whereas the clipboard is only overwritten by explicit cut or copy commands.
Under X, whenever the region is active (see Mark), the text in the region is saved in the primary selection. This applies regardless of whether the region was made by dragging or clicking the mouse (see Mouse Commands), or by keyboard commands (e.g., by typing C-SPC
and moving point; see Setting Mark).
If you change the variable select-active-regions
to only
, Emacs saves only temporarily active regions to the primary selection, i.e., those made with the mouse or with shift selection (see Shift Selection). If you change select-active-regions
to nil
, Emacs avoids saving active regions to the primary selection entirely.
To insert the primary selection into an Emacs buffer, click mouse-2
(mouse-yank-primary
) where you want to insert it. See Mouse Commands.
MS-Windows provides no primary selection, but Emacs emulates it within a single Emacs session by storing the selected text internally. Therefore, all the features and commands related to the primary selection work on Windows as they do on X, for cutting and pasting within the same session, but not across Emacs sessions or with other applications.