Removing extra blank lines in Emacs
If you want to get rid of extra blank lines in your text files, you can use the search and replace commands with regular expressions. However, for whatever reason, this does not work properly on my Windows machine.
Fortunately, I found a nice function definition at stackoverflow which does the job:
(defun single-lines-only ()
"replace multiple blank lines with a single one"
(while (re-search-forward "\\(^\\s-*$\\)\n" nil t)