1 个赞

The selection can be copied automatically if the OS supports primary selection by setting the below variable.

(setq x-select-enable-primary t)

From C-h v x-select-enable-primary , you get,

Non-nil means cutting and pasting uses the primary selection The existence of a primary selection depends on the underlying GUI you use. E.g. it doesn’t exist under MS-Windows.

To learn even more, visit the relevant info node by doing C-h i g (emacs) Primary Selection .

Another variable setting that goes in tandem with the above is to set the x-select-enable-clipboard to t . Doing that allows you to yank the contents copied from other X11 applications into emacs.

(setq x-select-enable-clipboard t)

When emacs 25.1 is released (supposedly the next stable version after 24.5), the x-select-enable-primary variable name will be deprecated and select-enable-primary must be used instead (removal of that x- prefix). Similarly x-select-enable-clipboard will be deprecated in favor of select-enable-clipboard .

2 个赞

Under X, every time the active region changes, Emacs saves the text in the region to the “primary selection”. This lets you insert that text into other X applications with ‘mouse-2’ clicks. *Note Primary

mouse-2 是鼠標中鍵。

1 个赞

这个插件对我来说功能有点复杂了, 用不了那么强大的功能。。:joy:



额,默认不就是选中即复制? 好吧,应该是系统带的功能,不是 Emacs 本身的。



同问, 我在pdf-tools中也无法自动复制选中的内容…

另外, 我发现在emacs里选中并自动复制的内容, 好像没有存入系统的剪切板中, 无法粘贴到其他软件里…