emacs, convert dos to unix and vice versa

If in emacs you need a different file coding system (line terminator), 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 to unix

M-x set-buffer-file-coding-system RET undecided-unix
save the file (C-x C-s)

or

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

Unix to dos

M-x set-buffer-file-coding-system RET undecided-dos
save the file (C-x C-s)

or

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

3 comments so far

  1. [...] 17, 2007 at 3:37 pm · Filed under emacs, windows Sometimes ago I posted how to convert a unix file into a dos one and vice versa. This works great on new empty file but cannot work on a already saved [...]

  2. Jeremy on

    Worked here on an already saved file in Windows.

  3. George Eckel on

    Thanks – handy-dandy, came right up on google, – fixed my (DOS) in gnu emacs !!


Leave a reply