Subject: bug#7001: should `byte-compile-from-buffer' evaluate `binary-overwrite-mode' explicitly?

From: Eli Zaretskii <[email-masked]>
Date: Sun, 03 Oct 2010 01:43:26 -0400

> From: Chong Yidong <[email-masked]>
> Cc: [email-masked], [email-masked], [email-masked]
> Date: Sun, 03 Oct 2010 00:32:15 -0400
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> >>
> >> > Most likely this line can be removed from bytecomp.el.
> >>
> >> The comments in bytecomp.el say this is needed for DOS.
> >
> > That comment is obsolete.  All file I/O works in binary mode on DOS
> > and Windows since at least 15 years ago.
> 
> Wow, that's some history ;-)  I've removed the line; thanks.

Just for the record: I meant to say that _Emacs_ file I/O on
DOS/Windows works in binary mode, not that DOS/Windows in general do
that.  The following part in emacs.c does the trick:

  #if defined (MSDOS) || defined (WINDOWSNT)
    /* We do all file input/output as binary files.  When we need to translate
       newlines, we do that manually.  */
    _fmode = O_BINARY;
  #endif /* MSDOS || WINDOWSNT */

  #ifdef MSDOS
    if (!isatty (fileno (stdin)))
      setmode (fileno (stdin), O_BINARY);
    if (!isatty (fileno (stdout)))
      {
	fflush (stdout);
	setmode (fileno (stdout), O_BINARY);
      }
  #endif /* MSDOS */