【发布时间】:2014-11-23 11:57:34
【问题描述】:
当您将文本从一个缓冲区复制到另一个缓冲区(M-w 和 C-y)时,它会使用字体锁定复制文本,当您粘贴它时,它会显示缓冲区中的颜色,我复制了文本。是否可以更改它以使其使用新缓冲区中的字体显示?
【问题讨论】:
当您将文本从一个缓冲区复制到另一个缓冲区(M-w 和 C-y)时,它会使用字体锁定复制文本,当您粘贴它时,它会显示缓冲区中的颜色,我复制了文本。是否可以更改它以使其使用新缓冲区中的字体显示?
【问题讨论】:
有关用户选项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。
【讨论】:
(add-to-list 'yank-excluded-properties 'font) 和 (add-to-list 'yank-excluded-properties 'font-lock-face) 但是当我从一些源代码拉到基本模式时,我仍然有颜色。
yank-handled-properties 的文档
我发现(set-text-properties (point) (mark) nil)删除所选区域的颜色。
我还想删除只读属性。但我不知道该怎么做。(对不起,这是我的问题。)
【讨论】:
在你的设置中使用这个:
(global-set-key (kbd "C-x C-r") (lambda()(interactive)(revert-buffer nil t)))
您需要执行 C-x C-s C-x C-r。
【讨论】:
font-lock-fontify-buffer,也许这就是你想要的。