comparison man/cc-mode.texi @ 75028:0922d91aab88

Changes for CC Mode 5.31.4. They are detailed in the ChangeLog entries for 2007-01-01.
author Alan Mackenzie <acm@muc.de>
date Mon, 01 Jan 2007 22:19:41 +0000
parents 993286e581a6
children 3d45362f1d38 d3099204c799 e4e4a56ef723
comparison
equal deleted inserted replaced
75027:9f636bd65206 75028:0922d91aab88
484 If you got this version of @ccmode{} with Emacs or XEmacs, it should 484 If you got this version of @ccmode{} with Emacs or XEmacs, it should
485 work just fine right out of the box. Note however that you might not 485 work just fine right out of the box. Note however that you might not
486 have the latest @ccmode{} release and might want to upgrade your copy 486 have the latest @ccmode{} release and might want to upgrade your copy
487 (see below). 487 (see below).
488 488
489 You should probably start by reading the entire chapter 489 You should probably start by skimming through the entire chapter
490 @ref{Commands} to get an overview of @ccmode{}'s capabilities. 490 @ref{Commands} to get an overview of @ccmode{}'s capabilities.
491 491
492 After trying out some commands, you may dislike some aspects of 492 After trying out some commands, you may dislike some aspects of
493 @ccmode{}'s default configuration. Here is an outline of how to 493 @ccmode{}'s default configuration. Here is an outline of how to
494 change some of the settings that newcomers to @ccmode{} most often 494 change some of the settings that newcomers to @ccmode{} most often
685 that begins at the line's left margin. 685 that begins at the line's left margin.
686 686
687 @item 687 @item
688 When it's @code{nil}, the command indents the line by an extra 688 When it's @code{nil}, the command indents the line by an extra
689 @code{c-basic-offset} columns. A prefix argument acts as a 689 @code{c-basic-offset} columns. A prefix argument acts as a
690 multiplier. A bare prefix (@kbd{C-u @key{TAB}} is equivalent to -1, 690 multiplier. A bare prefix (@kbd{C-u @key{TAB}}) is equivalent to -1,
691 removing @code{c-basic-offset} columns from the indentation. 691 removing @code{c-basic-offset} columns from the indentation.
692 @end itemize 692 @end itemize
693 693
694 The precise behavior is modified by several variables: With 694 The precise behavior is modified by several variables: With
695 @code{c-tab-always-indent}, you can make @key{TAB} insert whitespace 695 @code{c-tab-always-indent}, you can make @key{TAB} insert whitespace
878 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 878 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
879 879
880 @ccmode{} contains some useful commands for moving around in C code. 880 @ccmode{} contains some useful commands for moving around in C code.
881 881
882 @table @asis 882 @table @asis
883 @item @kbd{M-x c-beginning-of-defun} 883 @item @kbd{C-M-a}
884 @itemx @kbd{M-x c-end-of-defun} 884 @itemx @kbd{C-M-e}
885 @findex c-beginning-of-defun 885 @findex c-beginning-of-defun
886 @findex c-end-of-defun 886 @findex c-end-of-defun
887 @findex beginning-of-defun (c-) 887
888 @findex end-of-defun (c-) 888 Move to the beginning or end of the current or next function. Other
889 @findex beginning-of-defun 889 constructs (such as a structs or classes) which have a brace block
890 @findex end-of-defun 890 also count as ``functions'' here. To move over several functions, you
891 Move to the start or end of the current top-level definition. This is 891 can give these commands a repeat count.
892 the outermost brace pair which encloses point, together with the 892
893 function header or similar preamble which precedes the opening brace. 893 The start of a function is at its header. The end of the function is
894 after its closing brace, or after the semicolon of a construct (such
895 as a @code{struct}) which doesn't end at the brace. These two
896 commands try to leave point at the beginning of a line near the actual
897 start or end of the function. This occasionally causes point not to
898 move at all.
899
894 These functions are analogous to the Emacs built-in commands 900 These functions are analogous to the Emacs built-in commands
895 @code{beginning-of-defun} and @code{end-of-defun}, except they 901 @code{beginning-of-defun} and @code{end-of-defun}, except they
896 eliminate the constraint that the top-level opening brace of the defun 902 eliminate the constraint that the top-level opening brace of the defun
897 must be in column zero. See @ref{Defuns,,,@emacsman{}, 903 must be in column zero. See @ref{Defuns,,,@emacsman{},
898 @emacsmantitle{}}, for more information. 904 @emacsmantitle{}}, for more information.
899
900 Depending on the coding style you're using, you might prefer these two
901 commands to the standard Emacs ones. If so, consider binding them to
902 @kbd{C-M-a} and @kbd{C-M-e}. @xref{Sample .emacs File}. This
903 customization won't affect the special bindings for these key
904 sequences in force in AWK Mode. For backwards compatibility reasons,
905 the default bindings for @kbd{C-M-a} and @kbd{C-M-e} remain in effect.
906 905
907 @item @kbd{C-M-a} (AWK Mode) (@code{c-awk-beginning-of-defun}) 906 @item @kbd{C-M-a} (AWK Mode) (@code{c-awk-beginning-of-defun})
908 @itemx @kbd{C-M-e} (AWK Mode) (@code{c-awk-end-of-defun}) 907 @itemx @kbd{C-M-e} (AWK Mode) (@code{c-awk-end-of-defun})
909 @kindex C-M-a (AWK Mode) 908 @kindex C-M-a (AWK Mode)
910 @kindex C-M-e (AWK Mode) 909 @kindex C-M-e (AWK Mode)
911 @findex c-awk-beginning-of-defun 910 @findex c-awk-beginning-of-defun
912 @findex awk-beginning-of-defun (c-) 911 @findex awk-beginning-of-defun (c-)
913 @findex c-awk-end-of-defun 912 @findex c-awk-end-of-defun
914 @findex awk-end-of-defun (c-) 913 @findex awk-end-of-defun (c-)
915 Move back to the beginning or forward to the end of the current AWK 914 Move to the beginning or end of the current or next AWK defun. These
916 defun. These functions are bound to @kbd{C-M-a} and @kbd{C-M-e} by 915 commands can take prefix-arguments, their functionality being entirely
917 default in AWK Mode. They can take prefix-arguments, their 916 equivalent to @code{beginning-of-defun} and @code{end-of-defun}.
918 functionality being entirely equivalent to @code{beginning-of-defun}
919 and @code{end-of-defun}.
920 917
921 AWK Mode @dfn{defuns} are either pattern/action pairs (either of which 918 AWK Mode @dfn{defuns} are either pattern/action pairs (either of which
922 might be implicit) or user defined functions. Having the @samp{@{} and 919 might be implicit) or user defined functions. Having the @samp{@{} and
923 @samp{@}} (if there are any) in column zero, as is suggested for some 920 @samp{@}} (if there are any) in column zero, as is suggested for some
924 modes, is neither necessary nor helpful in AWK mode. 921 modes, is neither necessary nor helpful in AWK mode.
1092 comment, the new line gets the suitable indentation and comment line 1089 comment, the new line gets the suitable indentation and comment line
1093 prefix like @code{c-indent-new-comment-line}. In normal code it's 1090 prefix like @code{c-indent-new-comment-line}. In normal code it's
1094 indented like @code{newline-and-indent} would do. In macros it acts 1091 indented like @code{newline-and-indent} would do. In macros it acts
1095 like @code{newline-and-indent} but additionally inserts and optionally 1092 like @code{newline-and-indent} but additionally inserts and optionally
1096 aligns the line ending backslash so that the macro remains unbroken. 1093 aligns the line ending backslash so that the macro remains unbroken.
1097 @xref{Custom Macros}, for details about the backslash alignment. 1094 @xref{Custom Macros}, for details about the backslash alignment. In a
1095 string, a backslash is inserted only if the string is within a
1096 macro@footnote{In GCC, unescaped line breaks within strings are
1097 valid.}.
1098 1098
1099 This function is not bound to a key by default, but it's intended to be 1099 This function is not bound to a key by default, but it's intended to be
1100 used on the @kbd{RET} key. If you like the behavior of 1100 used on the @kbd{RET} key. If you like the behavior of
1101 @code{newline-and-indent} on @kbd{RET}, you should consider switching to 1101 @code{newline-and-indent} on @kbd{RET}, you should consider switching to
1102 this function. @xref{Sample .emacs File}. 1102 this function. @xref{Sample .emacs File}.
1708 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1708 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1709 1709
1710 Here are the various other commands that didn't fit anywhere else: 1710 Here are the various other commands that didn't fit anywhere else:
1711 1711
1712 @table @asis 1712 @table @asis
1713 @item @kbd{C-c .} (@code{c-set-style})
1714 @kindex C-c .
1715 @findex c-set-style
1716 @findex set-style (c-)
1717 Switch to the specified style in the current buffer. Use like this:
1718
1719 @example
1720 @kbd{C-c . @var{style-name} @key{RET}}
1721 @end example
1722
1723 You can use the @key{TAB} in the normal way to do completion on the
1724 style name. Note that all style names are case insensitive, even the
1725 ones you define yourself.
1726
1727 Setting a style in this way does @emph{not} automatically reindent your
1728 file. For commands that you can use to view the effect of your changes,
1729 see @ref{Indentation Commands} and @ref{Filling and Breaking}.
1730
1731 For details of the @ccmode{} style system, see @ref{Styles}.
1713 @item @kbd{C-c :} (@code{c-scope-operator}) 1732 @item @kbd{C-c :} (@code{c-scope-operator})
1714 @kindex C-c : 1733 @kindex C-c :
1715 @findex c-scope-operator 1734 @findex c-scope-operator
1716 @findex scope-operator (c-) 1735 @findex scope-operator (c-)
1717 In C++, it is also sometimes desirable to insert the double-colon scope 1736 In C++, it is also sometimes desirable to insert the double-colon scope
2361 The language specific mode hooks. The appropriate one is run as the 2380 The language specific mode hooks. The appropriate one is run as the
2362 last thing when you enter that language mode. 2381 last thing when you enter that language mode.
2363 @end defvar 2382 @end defvar
2364 2383
2365 Although these hooks are variables defined in @ccmode{}, you can give 2384 Although these hooks are variables defined in @ccmode{}, you can give
2366 them values before @ccmode{}'s code is loaded - indeed, this is the 2385 them values before @ccmode{}'s code is loaded---indeed, this is the
2367 only way to use @code{c-initialization-hook}. Their values aren't 2386 only way to use @code{c-initialization-hook}. Their values aren't
2368 overwritten when @ccmode{} gets loaded. 2387 overwritten when @ccmode{} gets loaded.
2369 2388
2370 Here's a simplified example of what you can add to your @file{.emacs} 2389 Here's a simplified example of what you can add to your @file{.emacs}
2371 file to do things whenever any @ccmode{} language is edited. See the 2390 file to do things whenever any @ccmode{} language is edited. See the
2474 @comment node-name, next, previous, up 2493 @comment node-name, next, previous, up
2475 @section Styles 2494 @section Styles
2476 @cindex styles 2495 @cindex styles
2477 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2496 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2478 2497
2498 By @dfn{style} we mean the layout of the code---things like how many
2499 columns to indent a block of code, whether an opening brace gets
2500 indented to the level of the code it encloses, or of the construct
2501 that introduces it, or ``hangs'' at the end of a line.
2502
2479 Most people only need to edit code formatted in just a few well-defined 2503 Most people only need to edit code formatted in just a few well-defined
2480 and consistent styles. For example, their organization might impose a 2504 and consistent styles. For example, their organization might impose a
2481 ``blessed'' style that all its programmers must conform to. Similarly, 2505 ``blessed'' style that all its programmers must conform to. Similarly,
2482 people who work on GNU software will have to use the GNU coding style. 2506 people who work on GNU software will have to use the GNU coding style.
2483 Some shops are more lenient, allowing a variety of coding styles, and as 2507 Some shops are more lenient, allowing a variety of coding styles, and as
2575 @node Choosing a Style, Adding Styles, Built-in Styles, Styles 2599 @node Choosing a Style, Adding Styles, Built-in Styles, Styles
2576 @comment node-name, next, previous, up 2600 @comment node-name, next, previous, up
2577 @subsection Choosing a Style 2601 @subsection Choosing a Style
2578 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2602 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2579 2603
2580 Use @kbd{C-c .} to choose a style interactively: 2604 When you create a new buffer, its style will be set from
2581 2605 @code{c-default-style}. The factory default is the style @code{gnu},
2582 @deffn Command c-set-style style-name 2606 except in Java and AWK modes where it's @code{java} and @code{awk}.
2583 @findex set-style (c-)
2584 @kindex C-c .
2585 Switch to the specified style in the current buffer. Use
2586 interactively like this:
2587
2588 @example
2589 @kbd{C-c . @var{style-name} @key{RET}}
2590 @end example
2591
2592 You can use the @key{TAB} in the normal way to do completion on the
2593 style name. Note that all style names are case insensitive, even the
2594 ones you define yourself.
2595
2596 Setting a style in this way does @emph{not} automatically reindent your
2597 file. For commands that you can use to view the effect of your changes,
2598 see @ref{Indentation Commands} and @ref{Filling and Breaking}.
2599 @end deffn
2600
2601 The default style in all newly created buffers is @code{gnu}, except
2602 in Java and AWK modes where it's @code{java} and @code{awk}.
2603 2607
2604 Remember that if you set a style variable with the Customization 2608 Remember that if you set a style variable with the Customization
2605 interface or at the top level of your @file{.emacs} file before the 2609 interface or at the top level of your @file{.emacs} file before the
2606 style system is initialised (@pxref{Config Basics}), this setting will 2610 style system is initialised (@pxref{Config Basics}), this setting will
2607 override the one that the style system would have given the variable. 2611 override the one that the style system would have given the variable.
2612
2613 To set a buffer's style interactively, use the command @kbd{C-c .}
2614 (@pxref{Other Commands}). To set it from a file's local variable
2615 list, @ref{File Styles}.
2608 2616
2609 @defopt c-default-style 2617 @defopt c-default-style
2610 @vindex default-style (c-) 2618 @vindex default-style (c-)
2611 This variable specifies which style to install by default in new 2619 This variable specifies which style to install by default in new
2612 buffers. It takes either a style name string, or an association list 2620 buffers. It takes either a style name string, or an association list
3245 give @code{c-syntactic-context} a value yourself---this would disrupt 3253 give @code{c-syntactic-context} a value yourself---this would disrupt
3246 the proper functioning of @ccmode{}. 3254 the proper functioning of @ccmode{}.
3247 3255
3248 This variable is also bound in three other circumstances: 3256 This variable is also bound in three other circumstances:
3249 (i)@w{ }when calling a c-hanging-semi&comma-criteria function 3257 (i)@w{ }when calling a c-hanging-semi&comma-criteria function
3250 (@pxref{Hanging Semicolons and Commas}; (ii)@w{ }when calling a 3258 (@pxref{Hanging Semicolons and Commas}); (ii)@w{ }when calling a
3251 line-up function (@pxref{Custom Line-Up}; (iii)@w{ }when calling a 3259 line-up function (@pxref{Custom Line-Up}); (iii)@w{ }when calling a
3252 c-special-indent-hook function (@pxref{Other Indentation}). 3260 c-special-indent-hook function (@pxref{Other Indentation}).
3253 @end defvar 3261 @end defvar
3254 3262
3255 As an example, @ccmode{} itself uses this feature to dynamically 3263 As an example, @ccmode{} itself uses this feature to dynamically
3256 determine the hanginess of braces which close ``do-while'' 3264 determine the hanginess of braces which close ``do-while''
3428 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 3436 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3429 3437
3430 @dfn{Clean-ups} are mechanisms which remove (or exceptionally, add) 3438 @dfn{Clean-ups} are mechanisms which remove (or exceptionally, add)
3431 whitespace in specific circumstances and are complementary to colon 3439 whitespace in specific circumstances and are complementary to colon
3432 and brace hanging. You enable a clean-up by adding its symbol into 3440 and brace hanging. You enable a clean-up by adding its symbol into
3433 @code{c-cleanup-list}. 3441 @code{c-cleanup-list}, e.g. like this:
3442
3443 @example
3444 (add-to-list 'c-cleanup-list 'space-before-funcall)
3445 @end example
3434 3446
3435 On the surface, it would seem that clean-ups overlap the functionality 3447 On the surface, it would seem that clean-ups overlap the functionality
3436 provided by the @code{c-hanging-*-alist} variables. Clean-ups, 3448 provided by the @code{c-hanging-*-alist} variables. Clean-ups,
3437 however, are used to adjust code ``after-the-fact'', i.e. to adjust 3449 however, are used to adjust code ``after-the-fact'', i.e. to adjust
3438 the whitespace in constructs later than when they were typed. 3450 the whitespace in constructs later than when they were typed.
3659 it's only an empty parenthesis pair. I.e. you will get @samp{signal 3671 it's only an empty parenthesis pair. I.e. you will get @samp{signal
3660 (SIGINT, SIG_IGN)}, but @samp{abort()}. Clean up occurs when the 3672 (SIGINT, SIG_IGN)}, but @samp{abort()}. Clean up occurs when the
3661 closing parenthesis is typed. 3673 closing parenthesis is typed.
3662 3674
3663 @item comment-close-slash 3675 @item comment-close-slash
3664 When inside a block comment, terminate the comment when you type a 3676 When inside a block comment, terminate the comment when you type a slash
3665 slash at the beginning of a line (i.e. immediately after the comment 3677 at the beginning of a line (i.e. immediately after the comment prefix).
3666 prefix). This clean-up removes whitespace preceding the slash and if 3678 This clean-up removes whitespace preceding the slash and if needed,
3667 needed, inserts a star to complete the token @samp{*/}. 3679 inserts a star to complete the token @samp{*/}. Type @kbd{C-q /} in this
3680 situation if you just want a literal @samp{/} inserted.
3668 @end table 3681 @end table
3669 3682
3670 3683
3671 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 3684 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3672 @node Indentation Engine Basics, Customizing Indentation, Clean-ups, Top 3685 @node Indentation Engine Basics, Customizing Indentation, Clean-ups, Top
5180 @vindex strict-syntax-p (c-) 5193 @vindex strict-syntax-p (c-)
5181 If an offset specification evaluates to @code{nil}, then a relative 5194 If an offset specification evaluates to @code{nil}, then a relative
5182 offset of 0 (zero) is used@footnote{There is however a variable 5195 offset of 0 (zero) is used@footnote{There is however a variable
5183 @code{c-strict-syntax-p} that when set to non-@code{nil} will cause an 5196 @code{c-strict-syntax-p} that when set to non-@code{nil} will cause an
5184 error to be signaled in that case. It's now considered obsolete since 5197 error to be signaled in that case. It's now considered obsolete since
5185 it doesn't work well with some of the alignment functions that returns 5198 it doesn't work well with some of the alignment functions that return
5186 @code{nil} instead of zero. You should therefore leave 5199 @code{nil} instead of zero. You should therefore leave
5187 @code{c-strict-syntax-p} set to @code{nil}.}. 5200 @code{c-strict-syntax-p} set to @code{nil}.}.
5188 5201
5189 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 5202 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
5190 @node Interactive Customization, Line-Up Functions, c-offsets-alist, Customizing Indentation 5203 @node Interactive Customization, Line-Up Functions, c-offsets-alist, Customizing Indentation
6547 @node Sample .emacs File, Performance Issues, Odds and Ends, Top 6560 @node Sample .emacs File, Performance Issues, Odds and Ends, Top
6548 @comment node-name, next, previous, up 6561 @comment node-name, next, previous, up
6549 @appendix Sample .emacs File 6562 @appendix Sample .emacs File
6550 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 6563 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6551 6564
6565 Here's a sample .emacs file fragment that might help you along the way.
6566 Just copy this region and paste it into your .emacs file. You might want
6567 to change some of the actual values.
6568
6552 @verbatim 6569 @verbatim
6553 ;; Here's a sample .emacs file fragment that might help you along the 6570 ;; Make a non-standard key binding. We can put this in
6554 ;; way. Just copy this region and paste it into your .emacs file.
6555 ;; You might want to change some of the actual values.
6556
6557 ;; Make some non-standard key bindings. We can put these in
6558 ;; c-mode-base-map because c-mode-map, c++-mode-map, and so on, 6571 ;; c-mode-base-map because c-mode-map, c++-mode-map, and so on,
6559 ;; inherit from it. 6572 ;; inherit from it.
6560 (defun my-c-initialization-hook () 6573 (defun my-c-initialization-hook ()
6561 (define-key c-mode-base-map "\C-m" 'c-context-line-break) 6574 (define-key c-mode-base-map "\C-m" 'c-context-line-break))
6562 (define-key c-mode-base-map [?\C-\M-a] 'c-beginning-of-defun)
6563 (define-key c-mode-base-map [?\C-\M-e] 'c-end-of-defun))
6564 (add-hook 'c-initialization-hook 'my-c-initialization-hook) 6575 (add-hook 'c-initialization-hook 'my-c-initialization-hook)
6565 6576
6566 ;; offset customizations not in my-c-style 6577 ;; offset customizations not in my-c-style
6567 ;; This will take precedence over any setting of the syntactic symbol 6578 ;; This will take precedence over any setting of the syntactic symbol
6568 ;; made by a style. 6579 ;; made by a style.
6645 column. Earlier still, this used to be a rigid Emacs constraint, as 6656 column. Earlier still, this used to be a rigid Emacs constraint, as
6646 embodied in the @code{beginning-of-defun} function. @ccmode now 6657 embodied in the @code{beginning-of-defun} function. @ccmode now
6647 caches syntactic information much better, so that the delay caused by 6658 caches syntactic information much better, so that the delay caused by
6648 searching for such a brace when it's not in column 0 is minimal, 6659 searching for such a brace when it's not in column 0 is minimal,
6649 except perhaps when you've just moved a long way inside the file. 6660 except perhaps when you've just moved a long way inside the file.
6650 Don't forget to rebind @kbd{C-M-a} and @kbd{C-M-e} to the @ccmode{}
6651 functions @code{beginning-of-defun} and @code{end-of-defun} if you're
6652 going to be hanging your braces! @xref{Sample .emacs File}.
6653 6661
6654 @findex defun-prompt-regexp 6662 @findex defun-prompt-regexp
6655 @vindex c-Java-defun-prompt-regexp 6663 @vindex c-Java-defun-prompt-regexp
6656 @vindex Java-defun-prompt-regexp (c-) 6664 @vindex Java-defun-prompt-regexp (c-)
6657 A special note about @code{defun-prompt-regexp} in Java mode: The common 6665 A special note about @code{defun-prompt-regexp} in Java mode: The common
6724 @cindex bugs 6732 @cindex bugs
6725 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 6733 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6726 6734
6727 @itemize @bullet 6735 @itemize @bullet
6728 @item 6736 @item
6737 @ccmode{} doesn't support trigraphs. (These are character sequences
6738 such as @samp{??(}, which represents @samp{[}. They date from a time
6739 when some character sets didn't have all the characters that C needs,
6740 and are now utterly obsolete.)
6741
6742 @item
6729 There is no way to apply auto newline settings (@pxref{Auto-newlines}) 6743 There is no way to apply auto newline settings (@pxref{Auto-newlines})
6730 on already typed lines. That's only a feature to ease interactive 6744 on already typed lines. That's only a feature to ease interactive
6731 editing. 6745 editing.
6732 6746
6733 To generalize this issue a bit: @ccmode{} is not intended to be used as 6747 To generalize this issue a bit: @ccmode{} is not intended to be used as
6745 The support for C++ templates (in angle brackets) is not yet complete. 6759 The support for C++ templates (in angle brackets) is not yet complete.
6746 When a non-nested template is used in a declaration, @ccmode{} indents 6760 When a non-nested template is used in a declaration, @ccmode{} indents
6747 it and font-locks it OK. Templates used in expressions, and nested 6761 it and font-locks it OK. Templates used in expressions, and nested
6748 templates do not fare so well. Sometimes a workaround is to refontify 6762 templates do not fare so well. Sometimes a workaround is to refontify
6749 the expression after typing the closing @samp{>}. 6763 the expression after typing the closing @samp{>}.
6764
6765 @item
6766 On loading @ccmode{}, sometimes this error message appears:
6767
6768 @example
6769 File mode specification error: (void-variable c-font-lock-keywords-3)
6770 @end example
6771
6772 This is due to a bug in the function @code{eval-after-load} in some
6773 versions of (X)Emacs. It can manifest itself when there is a symbolic
6774 link in the path of the directory which contains (X)Emacs. As a
6775 workaround, put the following into your @file{.emacs} file, fairly
6776 early on:
6777
6778 @example
6779 (defun my-load-cc-fonts ()
6780 (require "cc-fonts"))
6781 (add-hook 'c-initialization-hook 'my-load-cc-fonts)
6782 @end example
6750 @end itemize 6783 @end itemize
6751 6784
6752 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 6785 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6753 @node FAQ, Updating CC Mode, Limitations and Known Bugs, Top 6786 @node FAQ, Updating CC Mode, Limitations and Known Bugs, Top
6754 @comment node-name, next, previous, up 6787 @comment node-name, next, previous, up