]> code.delx.au - gnu-emacs/commitdiff
Fix ugly ^M characters in Diff output shown by "C-x v u".
authorEli Zaretskii <eliz@gnu.org>
Tue, 26 Nov 2013 19:17:55 +0000 (21:17 +0200)
committerEli Zaretskii <eliz@gnu.org>
Tue, 26 Nov 2013 19:17:55 +0000 (21:17 +0200)
 lisp/vc/vc.el (vc-diff-internal): Use *-dos coding-system when
 reading output from Diff on MS-Windows and MS-DOS.

lisp/ChangeLog
lisp/vc/vc.el

index 9554f8f45bb82e0411f915bfc161ccded3318af5..1e7fc7c9184d66d8fdaaa3289866bc5adc01d79e 100644 (file)
@@ -1,3 +1,8 @@
+2013-11-26  Eli Zaretskii  <eliz@gnu.org>
+
+       * vc/vc.el (vc-diff-internal): Use *-dos coding-system when
+       reading output from Diff on MS-Windows and MS-DOS.
+
 2013-11-26  Bozhidar Batsov  <bozhidar@batsov.com>
 
        * emacs-lisp/helpers.el (string-reverse): New function.
index bf69a1ccecccb4ed56af0a4b535c68cb62ed4c4c..0ef13bfc61d300babf0912b8fb0c126e138137b2 100644 (file)
@@ -1641,6 +1641,13 @@ Return t if the buffer had changes, nil otherwise."
         ;; be to call the back end separately for each file.
         (coding-system-for-read
          (if files (vc-coding-system-for-diff (car files)) 'undecided)))
+    ;; On MS-Windows and MS-DOS, Diff is likely to produce DOS-style
+    ;; EOLs, which will look ugly if (car files) happens to have Unix
+    ;; EOLs.
+    (if (memq system-type '(windows-nt ms-dos))
+       (setq coding-system-for-read
+             (coding-system-change-eol-conversion coding-system-for-read
+                                                  'dos)))
     (vc-setup-buffer buffer)
     (message "%s" (car messages))
     ;; Many backends don't handle well the case of a file that has been