gpt4 book ai didi

emacs - 如何使用 elisp/emacs 复制系统剪贴板中的某些内容而不是 kill ring?

转载 作者:行者123 更新时间:2023-12-04 03:15:15 26 4
gpt4 key购买 nike

我知道copy something to kill buffer,我可以用kill-new buffer

(kill-new (file-truename buffer-file-name))

将内容复制到剪贴板怎么样? emacs/elisp有没有提供这个功能?

已添加

我得到了 2 个答案,但答案似乎适用于 X windows 系统。当我使用 Aquamacs 时,它可能不是可以应用于我的问题的通用解决方案。

最佳答案

(x-set-selection nil (file-truename buffer-file-name))

Documentation for x-set-selection说:

This function sets a “selection” in the X server. It takes two arguments: a selection type type, and the value to assign to it, data. If data is nil, it means to clear out the selection. Otherwise, data may be a string, a symbol, an integer (or a cons of two integers or list of two integers), an overlay, or a cons of two markers pointing to the same buffer. An overlay or a pair of markers stands for text in the overlay or between the markers.

The argument data may also be a vector of valid non-vector selection values.

Each possible type has its own selection value, which changes independently. The usual values of type are PRIMARY, SECONDARY and CLIPBOARD; these are symbols with upper-case names, in accord with X Window System conventions. If type is nil, that stands for PRIMARY.

关于emacs - 如何使用 elisp/emacs 复制系统剪贴板中的某些内容而不是 kill ring?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3685806/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com