To generalize this issue a bit: CC Mode is not intended to be used as
a reformatter for old code in some more or less batch-like way. With
the exception of some functions like c-indent-region
, it’s only
geared to be used interactively to edit new code. There’s currently no
intention to change this goal.
If you want to reformat old code, you’re probably better off using some other tool instead, e.g. GNU indent in The ‘indent’ Manual, which has more powerful reformatting capabilities than CC Mode.
File mode specification error: (void-variable c-font-lock-keywords-3)
This is due to a bug in the function eval-after-load
in some
versions of (X)Emacs. It can manifest itself when there is a symbolic
link in the path of the directory which contains (X)Emacs. As a
workaround, put the following into your .emacs file, fairly
early on:
(defun my-load-cc-fonts () (require "cc-fonts")) (add-hook 'c-initialization-hook 'my-load-cc-fonts)