Search code examples
emacsnewlinelinefeed

How to set the default line terminator for new files in emacs?


Is there a something I can put in my .emacs config file to set the default line-ending style for newly created files?

I'm using GNU emacs for windows, but would like newly created files to use unix-style (line-feed only) line endings by default.


Solution

  • I have the following in my Windows section of my config:

    (setq-default buffer-file-coding-system 'utf-8-unix)
    (setq eol-mnemonic-dos "(DOS)")
    (setq eol-mnemonic-unix "\\")