Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Integrate Emacs copy/paste with System copy/paste

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?

like image 621
sligocki Avatar asked Jul 09 '10 19:07

sligocki


People also ask

Can you copy and paste into Emacs?

To cut the text, press C-w . To copy the text, press M-w . To paste the text, press C-y .

How do I copy and paste from outside in Emacs?

An Emacs copy is the command kill-ring-save (usually bound to M-w ). A system copy is what you typically get from pressing C-c (or choosing "Edit->Copy" in a application window). An X copy is "physically" highlighting text with the mouse cursor. An Emacs paste is the command yank (usually bound to C-y ).

How do I copy paste in Emacs terminal?

When you copy and paste text, the terminal does it : you're taking the text that the terminal displays and not the text that is in your emacs app. That's why you have to use terminal keybindings : Ctrl-Shift-C and Ctrl-Shift-V to copy and paste text.

How do you cut and paste an entire line of text in GNU Emacs?

Use C-S-Backspace (kill-whole-line) instead of C-k. You don't have to screw with cursor position or killing the newline.


2 Answers

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

like image 128
Nathan Geffen Avatar answered Sep 19 '22 13:09

Nathan Geffen


See clipboard-yank and clipboard-kill-region in the clipboard section of the manual.

like image 23
jamessan Avatar answered Sep 17 '22 13:09

jamessan