请问一下Linux下的emacs终端版怎么复制粘贴

当我选中的时候不能点击复制,这三这是怎么回事

直接用快捷键把

开启选择 Ctrl-空格

Alt-w 复制 Ctrl-y 粘贴

C-space:设置mark

光标移动:选择

M-w:复制

C-y:粘贴

其中,C:Ctrl,M:Alt

借宝地问一个相关的Linux剪贴板应用的问题,每次在emacs中输入,比如输入一个英文单词student,然后选择复制这个词的话,KDE的剪贴板管理程序Klipper会把整个选中过程都储存在剪贴板历史中,比如说现在的剪贴板历史就是第一项是student,第二项是tudent,第三项是udent等等,有没有办法避免这种剪贴板的污染呢?还是说这只是Klipper的问题,我也没用过其他的剪贴板管理应用

可能是开启了鼠标选中即复制的功能:info:emacs#Primary Selection:

Under the X Window System, there exists a “primary selection” containing the last stretch of text selected in an X application (usually by dragging the mouse). Typically, this text can be inserted into other X applications by ‘mouse-2’ clicks. The primary selection is separate from the clipboard. Its contents are more fragile; they are overwritten each time you select text with the mouse, whereas the clipboard is only overwritten by explicit cut or copy commands.

Under X, whenever the region is active (*note Mark::), the text in the region is saved in the primary selection. This applies regardless of whether the region was made by dragging or clicking the mouse (*note Mouse Commands::), or by keyboard commands (e.g., by typing ‘C-’ and moving point; *note Setting Mark::).

If you change the variable ‘select-active-regions’ to ‘only’, Emacs saves only temporarily active regions to the primary selection, i.e., those made with the mouse or with shift selection (*note Shift Selection::). If you change ‘select-active-regions’ to ‘nil’, Emacs avoids saving active regions to the primary selection entirely.

你可以试试用快捷键的方式来选中复制看看会不会出现这种情况。

似乎把select-active-regions改成nil这个问题就消失了

你这菜单是终端的,选区是 Emacs 的。终端根本不知道 Emacs 选区的存在,所以【复制】项是灰色的。

Emacs 中的高亮叫 region,对region的复制粘贴对应 Emacs 里面的kill-ring。终端的右键复制粘贴使用系统的剪贴板。这是两套文本复制粘贴系统,图形窗口的Emacs可以共用两套剪贴板,终端Emacs默认不行,你搜一下 emacs+xsel 找找配置。终端下两种机制选中的文本高亮都不一样。