emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/emacs-23 r99929: Fix bug #4451.


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-23 r99929: Fix bug #4451.
Date: Fri, 16 Jul 2010 13:17:13 +0300
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 99929
author: Reiner Steib <address@hidden>
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-23
timestamp: Fri 2010-07-16 13:17:13 +0300
message:
  Fix bug #4451.
  
   vc.el (vc-coding-system-inherit-eol): New defvar.
   (vc-coding-system-for-diff): Use it to decide whether to inherit
   from the file the EOL format for reading the diffs of that file.
modified:
  lisp/ChangeLog
  lisp/vc.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-07-16 09:59:37 +0000
+++ b/lisp/ChangeLog    2010-07-16 10:17:13 +0000
@@ -1,3 +1,10 @@
+2010-07-16  Reiner Steib  <address@hidden>
+
+       * vc.el (vc-coding-system-inherit-eol): New defvar.
+       (vc-coding-system-for-diff): Use it to decide whether to inherit
+       from the file the EOL format for reading the diffs of that file.
+       (Bug#4451)
+
 2010-07-16  Eli Zaretskii  <address@hidden>
 
        * mail/rmailmm.el (rmail-mime-save): Make the temp buffer

=== modified file 'lisp/vc.el'
--- a/lisp/vc.el        2010-06-22 01:26:30 +0000
+++ b/lisp/vc.el        2010-07-16 10:17:13 +0000
@@ -1398,6 +1398,16 @@
 ;;          (vc-call-backend ',(vc-backend f)
 ;;                           'diff (list ',f) ',rev1 ',rev2))))))
 
+(defvar vc-coding-system-inherit-eol t
+  "When non-nil, inherit the EOL format for reading Diff output from the file.
+
+Used in `vc-coding-system-for-diff' to determine the EOL format to use
+for reading Diff output for a file.  If non-nil, the EOL format is
+inherited from the file itself.
+Set this variable to nil if your Diff tool might use a different
+EOL.  Then Emacs will auto-detect the EOL format in Diff output, which
+gives better results.") ;; Cf. bug#4451.
+
 (defun vc-coding-system-for-diff (file)
   "Return the coding system for reading diff output for FILE."
   (or coding-system-for-read
@@ -1405,7 +1415,12 @@
       ;; use the buffer's coding system
       (let ((buf (find-buffer-visiting file)))
         (when buf (with-current-buffer buf
-                   buffer-file-coding-system)))
+                   (if vc-coding-system-inherit-eol
+                       buffer-file-coding-system
+                     ;; Don't inherit the EOL part of the coding-system,
+                     ;; because some Diff tools may choose to use
+                     ;; a different one.  bug#4451.
+                     (coding-system-base buffer-file-coding-system)))))
       ;; otherwise, try to find one based on the file name
       (car (find-operation-coding-system 'insert-file-contents file))
       ;; and a final fallback


reply via email to

[Prev in Thread] Current Thread [Next in Thread]