dpc
dpc

Reputation: 31

Using X11 clipboard in Emacs instance inside gnome-terminal

I am using Emacs 24.5.1 from the Gnome Terminal in Arch Linux. When I copy text from outside the Gnome Terminal window (from any other X window, e.g. Firefox), it is not available in the Emacs kill-ring. I have tried (setq x-select-enable-clipboard t) to no avail.

I have also tried this solution, which did not work.

Note: this functionality works when Emacs is run graphically; I am only having a problem when I run Emacs inside a terminal window.

Upvotes: 1

Views: 692

Answers (1)

Stefan
Stefan

Reputation: 28581

The development version of Emacs supports the so-called OSC-52 escape sequences which are supported by some terminals to let applications running inside the terminal access the clipboard.

Sadly, this OSC-52 feature can be (as currently designed in xterms) somewhat dangerous in some situations (e.g. if you display, via cat, in your terminal a file written by someone else), so most of the distributions have disabled the feature by default.

But least for me, under Debian testing, running Emacs-25 inside an xterm -xrm '*.allowWindowOps: true' lets me set the X clipboard via C-k just as if the Emacs was running in GUI mode.

Emacs also supports the direction you want (i.e. makes C-y in Emacs get the text from the X clipboard), tho you'll have to additionally add getSelection to your xterm-extra-capabilities in your ~/.emacs.

Upvotes: 3

Related Questions