CopyAndPaste

Terminology

Emacs has its own terminology for these concepts:

Common NameCommon KeyEmacs NameEmacs Key
Cut C-xKill C-w
Copy C-cKill-ring-save M-w
Paste C-vYank C-y
Yank next M-y

If you do not care for the DefaultKillingAndYanking key bindings, then consider these alternatives:

X11 Copy & Paste to/from Emacs:

X copy and paste support has historically been a mess. This is relevant, as Emacs supports the various aspects of this mess.

Important for this discussion is the understanding that X generally distinguishes between two types of selection, the PRIMARY and the CLIPBOARD. Every time you select a piece of text with the mouse, the selected text is set as the PRIMARY selection. Using the copy function will place the selected text into the CLIPBOARD. Pasting using the middle mouse button will insert the PRIMARY selection, pasting using the paste function will insert the CLIPBOARD.

With this out of the way, starting with Emacs 24.1, GNU Emacs should already do the right thing here. If you dislike this behavior, there are two options you can customize:

Yes, you can have Emacs use both at the same time.

This does not affect pasting using the middle mouse button. By default, this uses mouse-yank-primary, which will only look at the primary selection. If you want the middle mouse button to insert the clipboard instead, use the following:

  (global-set-key (kbd "<mouse-2>") 'x-clipboard-yank)

Finally, in other applications, pasting usually replaces the selected text with the contents of the clipboard. To enable this behavior in Emacs, use DeleteSelectionMode with the following:

  (delete-selection-mode)

XEmacs

 (setq interprogram-cut-function 'own-clipboard)
 (setq interprogram-paste-function 'get-clipboard)

CategoryEmulation CategoryKeys CategoryModes CategoryRegion