Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

emacs copy kill-ring to system clipboard in nowindow mode

I'm running "emacs -nw" under terminator program in Ubuntu. My issue, I couldn't get kill-ring to system clipboard with that. However, things works if run in X11 mode. Could you please help me with that?.

Thanks in advance..

like image 779
Xprog Avatar asked Jan 02 '11 22:01

Xprog


1 Answers

Emacs in "nw" mode is not linked to any of the X11 libraries. Because of this, you have no access to the X11 clipboard. In other words, this just isn't possible by itself. There are utilities that allow command-line access to and from the X11 clipboard. You would have to write some elisp code to tie kill-ring activity to whatever command-line tools you may use.

One such program you might look at is xclip. Getting the selection from the kill-ring into the clipboard won't be as hard as getting from the clipboard into the kill-ring. This is because you have control over the event when you add to the kill-ring. But emacs has no knowledge of when X11 updates the clipboard. So you may have to have a custom command rather than the typical yanking from kill-ring, one that uses xclip to fetch the current clipboard content.

This seems to me like something that someone would have already solved. I don't know enough elisp to tackle it by any measure, or I'd dig into it myself. I did find this blog post that points to an elisp library that wraps xclip. I don't know if that will help or not.

Randy

like image 107
rjray Avatar answered Oct 24 '22 23:10

rjray