Integrate Emacs copy/paste with System copy/paste

sligocki picture sligocki · Jul 9, 2010 · Viewed 12.2k times · Source

I have (cua-mode t) in my .emacs, so that C-c is copy and C-v is paste just like most other programs on my desktop (Ubuntu, Gnome, Linux). However, Emacs does not seem to share the clipboard/copy buffer with other programs.

For example, if I C-c in Firefox I can S-C-v to paste into a terminal or C-v to paste into gedit. However, if I C-v (or C-y) in emacs, I do not get what I copied from Firefox.

Is there any way to make this work? Is there another command I can use to access the system's copy-paste buffer?

Answer

Nathan Geffen picture Nathan Geffen · May 8, 2012

I had the same problem. I added this to my .emacs file:

(setq x-select-enable-clipboard t)
(setq interprogram-paste-function 'x-cut-buffer-or-selection-value)

Now Ctrl-C and Ctrl-v between Emacs and other applications work fine. Source: Ubuntu Forums