Emacs (line break/buffer coding system) Conversion From DOS to UNIX and Vice Versa

If in emacs you need a different file coding system (line terminator/line break), for example you are on a windows system and need to type a unix like text file (or vice versa), you can easily convert the buffer coding system.

DOS/Windows to UNIX


M-x set-buffer-file-coding-system RET undecided-unix

or


C-x RET f undecided-unix
C-x C-f

UNIX to DOS/Windows


M-x set-buffer-file-coding-system RET undecided-dos

or


C-x RET f undecided-dos
C-x C-f

Ref: http://edivad.wordpress.com/2007/04/03/emacs-convert-dos-to-unix-and-vice-versa/