Emacs and MAC New Line Character

A MAC file text file opened in some unix tools, display the text as one long line with ^M inserted in where a newline character should be. If you try to replace the ^M using emacs, it will display the file correctly but will not replace the newline chars. Emacs interprets the characters correctly.

To replace the ^M chars do this:

M-x set-buffer-file-coding-system RETURN unix

Emacs suggests:

ctrl-x RETURN f unix RETURN

Save the file and it will have the correct newline chars.


If its an MS text file, do this:


M-%
ctrl-q ctrl-m RETURN
ctrl-q ctrl-j RETURN
! (replaces for entire file)

That's it.