emacs 在 nowindow 模式下将kill-ring复制到系统剪贴板
我在 Ubuntu 的终结者程序下运行“emacs -nw”。我的问题是,我无法将kill-ring 发送到系统剪贴板。但是,如果在 X11 模式下运行,则一切正常。你能帮我吗?
提前致谢..
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..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
“nw”模式下的 Emacs 不链接到任何 X11 库。因此,您无法访问 X11 剪贴板。换句话说,这本身是不可能的。有一些实用程序允许通过命令行访问 X11 剪贴板或从 X11 剪贴板访问。您必须编写一些 elisp 代码来将终止环活动与您可能使用的任何命令行工具联系起来。
您可能会看到的一个此类程序是 xclip。将选择内容从kill-ring放入剪贴板不会像从剪贴板放入kill-ring 那样困难。这是因为当您添加到终止环时,您可以控制事件。但 emacs 不知道 X11 何时更新剪贴板。因此,您可能必须有一个自定义命令,而不是典型的从kill-ring中进行拉取,即使用xclip来获取当前剪贴板内容的命令。
在我看来,这似乎是有人已经解决的问题。我不知道足够的 elisp 来以任何方式解决这个问题,否则我会自己深入研究它。我确实发现这篇博文指向包装 xclip 的 elisp 库。我不知道这是否有帮助。
兰迪
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