Emacs: Change File Line Ending Between Windows/Unix/Mac

By Xah Lee. Date: .

Change File Line Ending Between Windows/Unix/Mac

  1. Open the file
  2. Alt + x set-buffer-file-coding-system.
  3. When it prompts you for a coding system, type one of: {mac, dos, unix}. (on Mac, use “unix”. For Microsoft Windows, use “dos”.)
  4. Then, save the file.

If you want utf-8 encoding, chose one of:

Which newline convention is used for the current file?

See the value in variable buffer-file-coding-system [see Emacs: Show Variable Value, List Variables]

Emacs Line Ending


Emacs Tutorial

Quick Start

Font

Split Window

File

Buffer

Copy/Paste

Find Replace

Unicode

Whitespace

Rectangle Edit

Line Wrap

Shell

View Special File

Editing Brackets

Org Mode

HTML

Emacs Efficiency

Misc