Skip to main content
Bumped by Community user
Bumped by Community user
edited title
Link

Emacs shell - git diff not displaying +inserted ("+") lines with dos file endings and color

added 157 characters in body
Source Link

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)

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 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?

(To create the above example I made a file with set-buffer-file-coding-system set to dos)

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)

Source Link

Emacs shell - git diff not displaying + lines with dos file endings

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 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?

(To create the above example I made a file with set-buffer-file-coding-system set to dos)