On certain occasions, when I save a buffer I have made changes to, it automatically adds ^M to the end of the lines. I find this problematic as it makes reading git diffs a pain. Is there any way to disable Emacs from doing this? Thanks.
Asked
Active
Viewed 329 times
1 Answers
3
You can specify the output encoding with C-xReturnf. You will notice that some encodings end in -dos
: these will insert ^M
at line ends. Select the encoding that ends in -unix
, it shouldn't add the characters.

choroba
- 231,213
- 25
- 204
- 289
-
Sorry about the confusion, but C-x Return f shows command options beginning with f. – i_trope Apr 30 '14 at 18:10
-
@user2475612, this is a bit of a strange keybinding. Make sure you're doing Ctrl+X, *then return*, then F. (Don't do F then return.) This should run `set-buffer-file-coding-system`. – ChrisGPT was on strike Apr 30 '14 at 19:50
-
Not sure what you've got customized, but `C-x f` defaults to `set-fill-column` – ocodo May 01 '14 at 00:58
-
1
-