简体   繁体   English

Emacs 猛拉行为已更改 - 如何恢复旧行为?

[英]Emacs yank behavior changed - how to get old behavior back?

This is on Linux (Ubuntu), working with emacs -nw in an xterm.这是在 Linux (Ubuntu) 上,在 xterm 中使用 emacs -nw。 GNU Emacs 26.3 GNU Emacs 26.3

Until recently I had two copy & paste mechanisms available:直到最近,我还有两种可用的复制和粘贴机制:

  1. kill some text using ^K ( kill-line ), it would go to the kill-ring, and could be retrieved using ^Y ( yank )使用 ^K ( kill-line ) 杀死一些文本,它将 go 发送到 kill-ring,并且可以使用 ^Y ( yank ) 检索

  2. select some text, possibly in another window, maybe in emacs or firefox, using the left mouse button, it would go to some X selection buffer, and could be retrieved using the middle mouse button. select 一些文本,可能在另一个 window 中,可能在 emacs 或 firefox 中,使用鼠标左键,它将 go 到某个 X 选择缓冲区,并且可以使用鼠标中键检索。

These two channels worked entirely independent of each other.这两个通道完全独立地工作。

Nowadays pasting a mouse selection pollutes the emacs kill-ring, or at least after mouse-pasting some text a yank also pastes that same text.现在粘贴鼠标选择会污染 emacs 杀圈,或者至少在鼠标粘贴一些文本后,猛拉也会粘贴相同的文本。

How can I teach emacs again not to change the kill-ring and use the unchanged kill-ring upon yank, independent of any mouse pasting?我怎样才能再次教 emacs 不更改 kill-ring 并在猛拉时使用未更改的 kill-ring,独立于任何鼠标粘贴? I tried a few combinations of (setq select-enable-clipboard t) and (setq select-enable-primary nil) but did not hit a successful.emacs incantation.我尝试了(setq select-enable-clipboard t)(setq select-enable-primary nil)的几种组合,但没有成功。emacs 咒语。

Try尝试

(setq interprogram-paste-function (lambda () nil))

If you've added something to the X11 clipboard, yank will try to insert that instead of the top of the kill ring using interprogram-paste-function .如果您已将某些内容添加到 X11 剪贴板, yank将尝试使用interprogram-paste-function将其插入而不是插入 kill ring 的顶部。 If ipf returns nil , it will use the top of kill-ring .如果ipf返回nil ,它将使用kill-ring的顶部。

When I run a terminal Emacs, gui-selection-value always returns nil anyway, so I'm not sure why yours doesn't.当我运行终端 Emacs 时, gui-selection-value总是返回nil ,所以我不确定为什么你的没有。


Looking at the source, (setq select-enable-clipboard nil select-enable-primary nil) should achieve the same result.查看源代码, (setq select-enable-clipboard nil select-enable-primary nil)应该达到相同的结果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM