If I modify a file checked into version control with DOS line endings, on a normal terminal I can see the change:
# Normal terminal...
$ git diff
diff --git a/a b/a
index c113281..85c3ecd 100644
--- a/a
+++ b/a
@@ -1,3 +1,3 @@
Line 1
-Line 2
+Line two^M
Line 3
However, in emacs shell (M-x shell
) I can only see the -
line - the +
line appears to have disappeared, presumably because it's interpreting the ^M
at the end as "go back to the start of the line (erasing any characters on it)":
# Emacs shell...
$ git diff
diff --git a/a b/a
index c113281..85c3ecd 100644
--- a/a
+++ b/a
@@ -1,3 +1,3 @@
Line 1
-Line 2
Line 3
This only happens if it's displaying colors, though I've no idea why that would be. It happens even if I start emacs with --no-init
, so I'm sure it's not just some weird setting in my config.
Any ideas on how to fix this? (I can work around with --color=never
but I'd rather have an actual fix)
(To create the above example I made a file with set-buffer-file-coding-system
set to dos
)