Emacs Paragraph Comments
Overview
I often want to write high level paragraph descriptions of functions as internal documentation to my code. I added a regular expression that determines the start of comments and can correctly indent them. Even if you add a word (making the line overflow the fill-column) you simply invoke fill-paragraph again and it will fix the line, without having to manually go through every line.
Usage
For a long paragraph with a comment in front, invoke "fill-paragraph"Fix into paragraphs in lisp.
Fix paragraphs in Lisp
Lets say you have a GPL clase and you want to properly align all the words. I have paragraphs seperated by ;; on the next line:

By invoking fill paragraph with M-q it fixes the paragraphs nicely:

If I modify the fill-column by typing: M-x set-fill column 50, and then re-invoking set-fill-column, I can easily make the paragarph line lengths very short if I want.

Fix C Comment Block
You can do the same for C comment blocks:
Long comment block:

Fixed comment block:

 Installation
Add the following code to your .emacs file
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; -----------------------------------------------------------------------------
;; -- C C++ C# Mode
;; -----------------------------------------------------------------------------
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(add-hook 'c-mode-common-hook
'(lambda ()
(set-fill-column 80)
;;M-q to fill /** */ Paragraph Segments
(setq paragraph-start "^[ ]*\\(///\\|\\**\\)[ ]*\\([ ]*$\\|@\\)\\|^\f")
))
About Nick Guthrie
» Nick Guthrie has written 38 posts