Say I have several files with different line endings (i.e. some have LF and others have CR+LF). If I somehow run diff on them and load the diff into Emacs (e.g. with C-x v D
, or just dumping the diff to a file and visiting it), I get mixed line endings in the diff buffer. This is more than just annoying ^M
s at the end of some lines, it breaks diff-apply-hunk
. If I delete the CRs, diff-apply-hunk
works, but at the expense of editing the buffer, which is undesirable when editing patch files.
How do others deal with this? Is there a way to make the line endings in the diff buffer consistent without changing the buffer contents?