Keithtastic

With a blog like this, who needs Facebook?
Jun 11
Permalink

Emacs tip of the day: force Unix/DOS line-break mode

Another wild and wooly Emacs tip for your enjoyment!  Have you ever opened a text file in Emacs, only to find it incorrectly detected the line-break format?  You might have been forced to use dos2unix, which may have confused your version control system.  Well there is a somewhat obscure command to force line-break mode:

set-buffer-file-coding-system undecided-dos

Arcane eh?  The default keybinding is even more so:

C-x RET f undecided-unix

As you probably gathered, it takes an argument of ‘undecided-dos’ or ‘undecided-unix’.  Who knew??