如何将所选区域粘贴到emacs之外? [英] How can i paste the selected region outside of emacs?

查看:85
本文介绍了如何将所选区域粘贴到emacs之外?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Mac OS和 emacs -nw (终端模式)。
我不知道如何在emacs之外粘贴的东西(已经在emacs -nw中被Mw实现)。



我知道 emacs -ns 可以这样做。



搜索互联网和命令Ch b,我找出了这个方法,但是没有工作。

 (setq x-select-enable-clipboard t)

setq interprogram-cut-function'x-select-text)

我不太了解论断程序的功能。
x-select-text来自哪里,这是什么意思?

解决方案

x-select-text 仅在您在GUI中运行Emacs时使用。 (Emacs将Mac / Windows粘贴板/剪贴板API映射到X11模型,因此名称)。您可以随时使用 Ch f 来了解有关像这样的函数的更多信息,并查看其定义是否以elisp编写。



在Mac上,没有关于 CLIPBOARD PRIMARY 选择的概念,所以没有意义设置 x-select-enable-clipboard



运行的整个点code> emacs - nw 是它不与窗口系统交互。为什么在终端上使用Emacs,在Mac上有很多图形化的Emacsen可以很好地工作?



那么说,如果你真的想将终端Emacs连接到Mac粘贴板,您可以这样做:

 (setq interprogram-cut-function 
(lambda(text& ;
(let *((process-connection-type nil)
(pbproxy(start-processpbcopypbcopy/ usr / bin / pbcopy)))
(process-send-string pbproxy text)
(process-send-eof pbproxy))))


I am using Mac OS and emacs -nw (the terminal mode). I don't know how can I paste things (having been implemented by M-w in emacs -nw) outside the emacs.

I know that the emacs -ns can do it.

Searching the internet and the command C-h b, i find out that method, but it didn't work out.

(setq x-select-enable-clipboard t)

(setq interprogram-cut-function 'x-select-text)

I don't know much about the argument of interprogram-cut-function. Where does the x-select-text come from and what does it mean?

解决方案

x-select-text is only used if you're running Emacs in a GUI. (Emacs maps the Mac/Windows pasteboard/clipboard APIs to the X11 model, hence the name). You can always use C-h f to find out more about a function like this one and view its definition if it's written in elisp.

On the Mac, there is no concept of CLIPBOARD versus PRIMARY selections, so there is no point in setting x-select-enable-clipboard.

The whole point of running emacs -nw is that it doesn't interact with the windowing system. Why use Emacs in a terminal when there are plenty of graphical Emacsen that work very nicely on the Mac?

That said, if you really wanted to hook up terminal Emacs to the Mac pasteboard, you could do something like this:

(setq interprogram-cut-function
      (lambda (text &optional push)
    (let* ((process-connection-type nil)
           (pbproxy (start-process "pbcopy" "pbcopy" "/usr/bin/pbcopy")))
      (process-send-string pbproxy text)
      (process-send-eof pbproxy))))

这篇关于如何将所选区域粘贴到emacs之外?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆