aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReiner Steib2010-07-16 13:17:13 +0300
committerEli Zaretskii2010-07-16 13:17:13 +0300
commitf253ef6a8e0dd71cf9fd58e3d9407549d30e091d (patch)
tree594d82be2e42943b4cf29b579cd2f882c2fe64dd
parent134a027f69b980b37204a93775116949c40166d1 (diff)
downloademacs-f253ef6a8e0dd71cf9fd58e3d9407549d30e091d.tar.gz
emacs-f253ef6a8e0dd71cf9fd58e3d9407549d30e091d.zip
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.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/vc.el17
2 files changed, 23 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index bdbc96a5afe..0ce0e8e3073 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12010-07-16 Reiner Steib <Reiner.Steib@gmx.de>
2
3 * vc.el (vc-coding-system-inherit-eol): New defvar.
4 (vc-coding-system-for-diff): Use it to decide whether to inherit
5 from the file the EOL format for reading the diffs of that file.
6 (Bug#4451)
7
12010-07-16 Eli Zaretskii <eliz@gnu.org> 82010-07-16 Eli Zaretskii <eliz@gnu.org>
2 9
3 * mail/rmailmm.el (rmail-mime-save): Make the temp buffer 10 * mail/rmailmm.el (rmail-mime-save): Make the temp buffer
diff --git a/lisp/vc.el b/lisp/vc.el
index 194c2a08983..a7d4ec66391 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -1398,6 +1398,16 @@ Runs the normal hooks `vc-before-checkin-hook' and `vc-checkin-hook'."
1398;; (vc-call-backend ',(vc-backend f) 1398;; (vc-call-backend ',(vc-backend f)
1399;; 'diff (list ',f) ',rev1 ',rev2)))))) 1399;; 'diff (list ',f) ',rev1 ',rev2))))))
1400 1400
1401(defvar vc-coding-system-inherit-eol t
1402 "When non-nil, inherit the EOL format for reading Diff output from the file.
1403
1404Used in `vc-coding-system-for-diff' to determine the EOL format to use
1405for reading Diff output for a file. If non-nil, the EOL format is
1406inherited from the file itself.
1407Set this variable to nil if your Diff tool might use a different
1408EOL. Then Emacs will auto-detect the EOL format in Diff output, which
1409gives better results.") ;; Cf. bug#4451.
1410
1401(defun vc-coding-system-for-diff (file) 1411(defun vc-coding-system-for-diff (file)
1402 "Return the coding system for reading diff output for FILE." 1412 "Return the coding system for reading diff output for FILE."
1403 (or coding-system-for-read 1413 (or coding-system-for-read
@@ -1405,7 +1415,12 @@ Runs the normal hooks `vc-before-checkin-hook' and `vc-checkin-hook'."
1405 ;; use the buffer's coding system 1415 ;; use the buffer's coding system
1406 (let ((buf (find-buffer-visiting file))) 1416 (let ((buf (find-buffer-visiting file)))
1407 (when buf (with-current-buffer buf 1417 (when buf (with-current-buffer buf
1408 buffer-file-coding-system))) 1418 (if vc-coding-system-inherit-eol
1419 buffer-file-coding-system
1420 ;; Don't inherit the EOL part of the coding-system,
1421 ;; because some Diff tools may choose to use
1422 ;; a different one. bug#4451.
1423 (coding-system-base buffer-file-coding-system)))))
1409 ;; otherwise, try to find one based on the file name 1424 ;; otherwise, try to find one based on the file name
1410 (car (find-operation-coding-system 'insert-file-contents file)) 1425 (car (find-operation-coding-system 'insert-file-contents file))
1411 ;; and a final fallback 1426 ;; and a final fallback