http://www.perlmonks.org?node_id=567643


in reply to Adding '#' in the beginning of each line

This seems like a fairly pointless exercise, here's how I'd solve it: I bet someone'll tell me theres a "comment-buffer" now!

Caveat, only works on modes where emacs thinks the comment-char is "#".

C.