My emacs deletes trailing white space. How can I disable this behaviour?

后端 未结 3 1308
深忆病人
深忆病人 2021-01-04 12:45

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 beh

3条回答
  •  执笔经年
    2021-01-04 13:34

    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)
    

    or

    (add-hook 'before-save-hook 'delete-trailing-whitespace)
    

    This emacswiki page gives tons of advice on handling trailing whitespace.

    If you want to delete trailing whitespace only on lines you modify, you could try the ws-trim package

提交回复
热议问题