I have tried
(set (make-local-variable 'comment-auto-fill-only-comments) t)
and also
(auto-fill-mode 0)
Though amazingly, neither of those work after emacs is restarted.
I am using eschulte's emacs starter kit
Toggling it works fine with M-x auto-fill-mode.
UPDATE
Using a combination of (thanks Rémi):
(auto-fill-mode 1)
(setq comment-auto-fill-only-comments t)
It works perfectly within programming files, where there are comments. However, in text mode, it auto-fills everywhere.
How can I turn off auto-fill-mode completely when inside text documents?
describe-function,describe-variableto find out how you could use a function, a variable. - jfsdescribe-variable, it may show you thatcomment-auto-fill-only-commentsis not what you think it is. If that's the case, then possibly there's a hook running after you set the value, that stomps on your value. - Cheeso