Limitations and Known Bugs
CC Mode doesn’t support trigraphs. (These are character sequences such as ‘
??(’, which represents ‘[’. They date from a time when some character sets didn’t have all the characters that C needs, and are now utterly obsolete.)There is no way to apply auto newline settings (see Auto-newline Insertion) on already typed lines. That’s only a feature to ease interactive editing.
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.
The support for C++ templates (in angle brackets) is not yet complete. When a non-nested template is used in a declaration, CC Mode indents it and font-locks it OK. Templates used in expressions, and nested templates do not fare so well. Sometimes a workaround is to refontify the expression after typing the closing ‘
>’.In a k&r region (the part of an old-fashioned C function declaration which specifies the types of its parameters, coming between the parameter list and the opening brace), there should be at most 20 top-level parenthesis and bracket pairs. This limit has been imposed for performance reasons. If it is violated, the source file might be incorrectly indented or fontified.
On loading CC Mode, sometimes this error message appears:
File mode specification error: (void-variable c-font-lock-keywords-3)This is due to a bug in the function
eval-after-loadin 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.emacsfile, fairly early on:emacs-lisp(defun my-load-cc-fonts () (require "cc-fonts")) (add-hook 'c-initialization-hook 'my-load-cc-fonts)