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, eg 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 (eg 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 Ck
just as if the Emacs was running in GUI mode.
Emacs also supports the direction you want (ie makes Cy
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
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.