The Lone C++ Coder's Blog

The Lone C++ Coder's Blog

The continued diary of an experienced C++ programmer. Thoughts on C++ and other languages I play with, Emacs, functional, non functional and sometimes non-functioning programming.

Timo Geusch

1-Minute Read

I’ve previously blogged about using Emacs to convert line endings and use it as an alternative to the dos2unix/unix2dos tools. Using set-buffer-file-coding-system works well and has been my go-to conversion method.

That said, there is another way to do the same conversion by using M-x recode-region. As the name implies, recode-region works on a region. As a result, it offers better control over where the line ending conversion is applied. This is extremely useful if you’re dealing with a file with mixed line endings.

Mixed line endings due to version control misconfiguration are actually the main reason for me having to use these type of tools in the first place…

Recent Posts



A developer's journey. Still trying to figure out this software thing after several decades.