我的emacs删除尾随的空格。如何禁用此行为? [英] My emacs deletes trailing white space. How can I disable this behaviour?
问题描述
保存(我想),我的emacs正在删除尾随的空格。我不想提交这些更改,只有我手动修改的部分。有没有办法禁用这种行为?
Upon save ( I think ), my emacs is deleting trailing white space. I don't want to commit those changes, only the parts I manually modify. Is there a way to disable that behaviour?
推荐答案
此行为不是标准的。然而,这是一个非常常见的定制,您可能借用于某个地方。在您的init文件中查找以下内容,并注释掉这些行以摆脱这种行为(并且Emacs保存文件,而不会完全删除空格):
This behaviour is not standard. It is however a very common customization that you might have borrowed somewhere. Look for something like the following in you init file and comment out those lines to get rid of this behaviour (and have Emacs save files as they are, without removing whitespace altogether):
(add-to-list 'write-file-functions 'delete-trailing-whitespace)
或
(add-hook 'before-save-hook 'delete-trailing-whitespace)
这个emacswiki page 给出了处理尾随空格的许多建议。
This emacswiki page gives tons of advice on handling trailing whitespace.
如果要仅删除尾随空格在修改的行上,您可以尝试 ws-trim 包
If you want to delete trailing whitespace only on lines you modify, you could try the ws-trim package
这篇关于我的emacs删除尾随的空格。如何禁用此行为?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!