如何在emacs中复制粘贴而不锁定源字体?

问题描述 投票:0回答:4

当您将文本从一个缓冲区复制到另一个缓冲区(M-w 和 C-y)时,它会使用字体锁定复制文本,当您粘贴它时,它会显示我复制的文本缓冲区中的颜色。是否可以更改它以使其使用新缓冲区中的字体显示?

emacs colors elisp
4个回答
8
投票

请参阅文档了解用户选项

yank-excluded-properties
yank-handled-properties
。 从
yank
的文档开始:
C-h f yank
。 它告诉你:

When this command inserts text into the buffer, it honors the
`yank-handled-properties' and `yank-excluded-properties'
variables, and the `yank-handler' text property.  See
`insert-for-yank-1' for details.

IOW,只需告诉

yank
不要粘贴
face
font-lock-face
等属性。

另请参阅 Elisp 手册,节点

Yanking


2
投票

我发现

(set-text-properties (point) (mark) nil)
删除所选区域的颜色。

我还想删除只读属性。但我不知道该怎么做。(对不起,这是我的问题。)


0
投票

将以下内容添加到您的配置中:

(setq yank-excluded-properties t)

-1
投票

在您的设置中使用此:

(global-set-key (kbd "C-x C-r") (lambda()(interactive)(revert-buffer nil t)))

您需要执行C-x C-s C-x C-r

© www.soinside.com 2019 - 2024. All rights reserved.