Subject: Re: bug#4533: 23.1: reverting fails to update line ending mode line

From: Eli Zaretskii <[email-masked]>
Date: Sun, 14 Nov 2010 04:51:13 -0500

> From: Chong Yidong <[email-masked]>
> Date: Sat, 13 Nov 2010 17:27:18 -0500
> Cc: [email-masked]
> 
> > - 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
> > - C-x k RET
> > - C-x C-f ~/foo.txt
> > Mode line shows --(Unix)---
> 
> The problem is that `C-x C-s' sets buffer-file-coding-system-explicit.
> This causes revert-buffer to set coding-system-for-read to that value
> (which is now incorrect) when inserting the file contents.  This is why
> the revert goes correctly if you omit the `C-x C-s' step.

Why is this a real problem?  I can handle this situation with

    C-x RET c undecided RET M-x revert-buffer RET

(Perhaps "C-x RET r" should be fixed to do the same, when given
`undecided' as the encoding.)

> I think the use of buffer-file-coding-system-explicit in revert-buffer
> is bogus, and should be removed---see below.  What do you think?

I'm not sure it's bogus.  Why do you think so?

Perhaps Handa-san remembers why this variable was introduced in the
first place.  I'm sure it was to solve some real-life problems.