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.
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 viaC-kjust as if the Emacs was running in GUI mode.Emacs also supports the direction you want (i.e. makes
C-yin Emacs get the text from the X clipboard), tho you'll have to additionally addgetSelectionto yourxterm-extra-capabilitiesin your~/.emacs.