Subject: Re: bug#4533: i can reproduce this

From: Glenn Morris <[email-masked]>
Date: Mon, 02 Nov 2009 03:11:16 -0500

tags 4533 =
stop

Jack Tanner wrote:

> - Start emacs -Q .
> - C-x C-f ~/foo.txt, creating a new file.
> - Enter text: 
> Line 1
> Line 2
>
> - C-x C-s.
> - dos2unix ~/foo.txt
> - M-x revert-buffer

Thanks for the recipe. Saving the file was the missing step.

The issue seems to be that saving a file causes basic-save-buffer-1 to
set buffer-file-coding-system-explicit. Eg for me on GNU/Linux, it is
set to (iso-latin-1-unix). revert-buffer uses this to set
coding-system-for-read before it inserts the file contents. So the
change in line ending is ignored. If I manually set
buffer-file-coding-system-explicit to nil before reverting the buffer,
the change in line ending is noticed.

I don't know what the right fix is though.