Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

emacs change default line ending

In Windows, Emacs is using cr-lf for a linebreak, but I like all my files to use Unix line endings (lf). I found a way to change it during my session, but I am not such an Emacs guru to translate the solution into an elisp command in my .emacs file.

Can anybody help me, so Emacs in Windows will use lf permanently?

like image 738
Sambatyon Avatar asked Mar 18 '12 17:03

Sambatyon


1 Answers

As per the comment by Brian Burns, use this for modern Emacs.

(setq-default buffer-file-coding-system 'utf-8-unix)

Prior to Emacs 23.2, you would use

(setq default-buffer-file-coding-system 'utf-8-unix)

See also How to configure GNU Emacs to write UNIX or DOS formatted files by default?

like image 125
tripleee Avatar answered Oct 06 '22 16:10

tripleee