Browse hg Repository
Contributions and links
SourceForge project page
As of version 5.26, CC Mode uses adaptive filling for text in
comments and string literals. Thus it's now possible to use Kyle
E. Jones' Filladapt package (http://wonderworks.com/) inside CC
Mode to get better handling of e.g. bulleted lists in comments.
To set up Filladapt for use with CC Mode:
- Make sure you have Filladapt installed. It's available from
the canonical web site. You
can also download version 2.12 from
the CC Mode site.
You might instead want to download a patched version of Filladapt that corrects a
small problem (see below). The suggested patch is also available in context diff
form if you prefer to patch it yourself.
- Configure the Filladapt variables for use in CC Mode. The
easiest way to do this is to add something like this your
(defun my-c-mode-common-hook ()
(add-hook 'c-mode-common-hook 'my-c-mode-common-hook)
This uses the
c-setup-filladapt convenience function
that comes with CC Mode to modify the Filladapt variables according
to the comment syntax and
There is a minor problem, or rather lack of a feature, in the
current version of Filladapt (2.12 when this is written) that makes it
do a poor job when the regexp on
matches the empty string. The effect is that Filladapt fills only
parts of a paragraph, or nothing at all. You can fix this problem in
- Make sure
c-comment-prefix-regexp can't match
the empty string (by default it does). This is probably not a good
idea since many block comment styles use nothing but whitespace
before the text.
- Set up the Filladapt variables yourself instead of using
c-setup-filladapt. You'll have to make sure those
variables agrees with
c-comment-prefix-regexp, or else you'll get very
awkward behavior when editing comments.
- Download this patch and apply
it to the original 2.12 version.
There's also an already patched version
The patch adds a feature to Filladapt which makes it ignore
tokens that matches the empty string when it analyzes the fill
prefix. A variable
controls which tokens are allowed to match the empty string
end-of-line are meaningful).
To the best of my knowledge, this patch doesn't cause any adverse
side effects in other modes. On the contrary, it's quite possible
that it fixes similar problems elsewhere too. The patch has been
submitted to Kyle E. Jones, and hopefully it will be included in a
future version of Filladapt.