我的emacs删除尾随的空格。如何禁用此行为? [英] My emacs deletes trailing white space. How can I disable this behaviour?

查看:87
本文介绍了我的emacs删除尾随的空格。如何禁用此行为?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

保存(我想),我的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆