[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#4451: 23.1; EOL problems with vc-diff and cygwin
From: |
Reiner Steib |
Subject: |
bug#4451: 23.1; EOL problems with vc-diff and cygwin |
Date: |
Fri, 16 Jul 2010 08:51:37 +0200 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/22.1 (gnu/linux) |
On Thu, Jul 15 2010, Eli Zaretskii wrote:
>> From: Reiner Steib <reinersteib+gmane@imap.cc>
>> Cc: 4451@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
>> Date: Thu, 15 Jul 2010 09:22:39 +0200
>>
>> > So I agree with Stefan that you should simply not overwrite the
>> > checked-out file with Unix EOLs. We could install the change
>> > suggested by Stefan (based on this analysis, I no longer object to
>> > it),
>>
>> If nobody else objects, may I install[1] Stefan's patch? Or we could
>> make it depend on some variable as well ...
>
> Fine with me.
Thanks.
>> +(defvar vc-coding-system-strip-eol t ;; nil
>> + "When non-nil, don't inherit the EOL part of the coding-system.")
>
> Instead of a slightly misleading name (you don't really "strip" EOL)
> and double negation, I would suggest an option named
> vc-coding-system-inherit-eol, non-nil by default (to keep the current
> operation), and reverse the condition in the patch.
Heres an updated patch. Could someone please apply it (I don't have
the current sources - no bzr checkout yet)?
--8<---------------cut here---------------start------------->8---
--- vc.el 7 Dec 2009 09:02:16 -0000 1.746
+++ vc.el 16 Jul 2010 06:47:30 -0000
@@ -1388,6 +1388,12 @@
;; (vc-call-backend ',(vc-backend f)
;; 'diff (list ',f) ',rev1 ',rev2))))))
+(defvar vc-coding-system-inherit-eol t
+ "When non-nil, inherit the EOL part of the coding-system from buffer.
+Set this variable to nil if your diff tools chooses to use other
+EOL type than the current buffer. Then auto-detection gives
+better.") ;; 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
@@ -1395,7 +1401,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
+ ;; another 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
--8<---------------cut here---------------end--------------->8---
Bye, Reiner.
--
,,,
(o o)
---ooO-(_)-Ooo--- | PGP key available | http://rsteib.home.pages.de/