next up previous contents
Next: Multiple Windows, Buffers, and Up: Formatting Previous: Formatting   Contents

End of Line Characters

If you frequently deal with text files created by Windows users, you will no doubt encounter the frustrating $\backslash$M character littered throughout the text. Remember that Unix, Windows, and Macintoshes all deal with the end of lines differently. Windows marks the end of a line with two characters - an end of line ($\backslash$ n) and a carriage return ($\backslash$ r). Unix just uses the end of line ($\backslash$ n), and Macintosh just uses the carriage return ($\backslash$ r). When you open a text file originally created in Windows, the $\backslash$M characters represent left-over carriage returns emacs didn't know what to do with. There is an easy way to get rid of them by just searching and replacing. Navigate to one of them, select it the way you would any other character or expression, and copy it using M-w. Then Hit M-% to begin a search and replace session. When emacs asks what to replace, hit C-y (yank). When emacs asks with what to replace the character, just hit return. Emacs will then remove all those $\backslash$M characters.


next up previous contents
Next: Multiple Windows, Buffers, and Up: Formatting Previous: Formatting   Contents
Randall Wood 2007-07-04