In source-code one usually doesn’t want filling to occur. On the other hand, comments are really more like text than code. This example shows how to set up filling for comments only in c-mode.
(add-hook 'c-mode-hook (lambda () (auto-fill-mode 1) (set (make-local-variable 'fill-nobreak-predicate) (lambda () (not (eq (get-text-property (point) 'face) 'font-lock-comment-face))))))
In order to enable this feature, you can use the following in plain GNU Emacs (tested with 23.1).
(setq comment-auto-fill-only-comments t)
The package rebox.el may also help with refilling multi-line comments within a comment “box”. For example,
/*---------------------------------------------. | Called by semantic_selection(). | | | | Performs two checks in the following order: | | | | A) If our time limit has changed between | | calls to this function, extension of each | | maxiset by each of its failed SOS clauses is | | attempted. | | | | B) If any maxiset has a new model | | (witnessing its consistency) each of its | | failed clauses (all lists) are retested. | `---------------------------------------------*/
See also rebox2.