1

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.

Community
  • 1
  • 1
dpc
  • 41
  • 1
  • 4
  • Found a [solution] (http://emacs.stackexchange.com/questions/412/copy-and-paste-between-emacs-in-an-x-terminal-and-other-x-applications) (albeit a messy one) to my problem hiding on the new emacs stackexchange page (didn't show up when I searched). – dpc Jul 05 '15 at 01:44

1 Answers1

3

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.

Stefan
  • 27,908
  • 4
  • 53
  • 82