Mercurial > emacs
annotate man/cc-mode.texi @ 56113:c4c0d60fa2da
(Dired Enter): Mention conditions on `ls' switches.
(Dired and Find): Mention differences with ordinary Dired buffers.
author | Luc Teirlinck <teirllm@auburn.edu> |
---|---|
date | Mon, 14 Jun 2004 22:04:53 +0000 |
parents | cd954d951766 |
children | b7446b6f097d 4c90ffeb71c5 |
rev | line source |
---|---|
25829 | 1 \input texinfo |
2 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3 @c Notes to self regarding line handling: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4 @c |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5 @c Empty lines are often significant before @end directives; avoid them. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
6 @c |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
7 @c Empty lines before and after @example directives are significant in |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
8 @c info output but not in TeX. Empty lines inside @example directives |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
9 @c are significant. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
10 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
11 @c Conventions for formatting examples: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
12 @c o If the example contains empty lines then put the surrounding empty |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
13 @c lines inside the @example directives. Put them outside otherwise. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
14 @c o Use @group inside the example only if it shows indentation where |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
15 @c the relation between lines inside is relevant. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
16 @c o Format line number columns like this: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
17 @c 1: foo |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
18 @c 2: bar |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
19 @c ^ one space |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
20 @c ^^ two columns, right alignment |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
21 @c o Check line lengths in TeX output; they can typically be no longer |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
22 @c than 70 chars, 60 if the paragraph is indented. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
23 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
24 @comment TBD: Document the finer details of statement anchoring? |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
25 |
25829 | 26 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
27 @comment %**start of header (This is for running Texinfo on a region) | |
28 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
29 | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
30 @comment No overfull hbox marks in the dvi file. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
31 @finalout |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
32 |
36924
28d23bbdd2cf
Version merged with the one from CC mode 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
36923
diff
changeset
|
33 @setfilename ../info/ccmode |
36923 | 34 @settitle CC Mode Manual |
25829 | 35 @footnotestyle end |
36 | |
37 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
38 @comment @setchapternewpage odd !! we don't want blank pages !! | |
39 @comment %**end of header (This is for running Texinfo on a region) | |
40 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
41 | |
42 | |
43 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
44 @comment |
25829 | 45 @comment Texinfo manual for CC Mode |
46 @comment Generated from the original README file by Krishna Padmasola | |
47 @comment <krishna@earth-gw.njit.edu> | |
36923 | 48 @comment |
49 @comment Authors: | |
50 @comment Barry A. Warsaw | |
51 @comment Martin Stjernholm | |
52 @comment | |
30396
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
53 @comment Maintained by Martin Stjernholm <bug-cc-mode@gnu.org> |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
54 @comment |
25829 | 55 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
56 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
57 @comment Define an index for syntactic symbols. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
58 @defindex ss |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
59 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
60 @comment Combine key, syntactic symbol and concept indices into one. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
61 @syncodeindex ss cp |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
62 @syncodeindex ky cp |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
63 |
47737
0a70200bde27
use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents:
46918
diff
changeset
|
64 @copying |
0a70200bde27
use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents:
46918
diff
changeset
|
65 This manual is for CC Mode in Emacs. |
0a70200bde27
use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents:
46918
diff
changeset
|
66 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
67 Copyright @copyright{} 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
68 2003 Free Software Foundation, Inc. |
47737
0a70200bde27
use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents:
46918
diff
changeset
|
69 |
0a70200bde27
use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents:
46918
diff
changeset
|
70 @quotation |
36924
28d23bbdd2cf
Version merged with the one from CC mode 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
36923
diff
changeset
|
71 Permission is granted to copy, distribute and/or modify this document |
28d23bbdd2cf
Version merged with the one from CC mode 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
36923
diff
changeset
|
72 under the terms of the GNU Free Documentation License, Version 1.1 or |
28d23bbdd2cf
Version merged with the one from CC mode 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
36923
diff
changeset
|
73 any later version published by the Free Software Foundation; with the |
28d23bbdd2cf
Version merged with the one from CC mode 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
36923
diff
changeset
|
74 Invariant Sections being ``The GNU Manifesto'', ``Distribution'' and |
28d23bbdd2cf
Version merged with the one from CC mode 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
36923
diff
changeset
|
75 ``GNU GENERAL PUBLIC LICENSE'', with the Front-Cover texts being ``A GNU |
28d23bbdd2cf
Version merged with the one from CC mode 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
36923
diff
changeset
|
76 Manual'', and with the Back-Cover Texts as in (a) below. A copy of the |
28d23bbdd2cf
Version merged with the one from CC mode 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
36923
diff
changeset
|
77 license is included in the section entitled ``GNU Free Documentation |
28d23bbdd2cf
Version merged with the one from CC mode 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
36923
diff
changeset
|
78 License'' in the Emacs manual. |
28d23bbdd2cf
Version merged with the one from CC mode 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
36923
diff
changeset
|
79 |
28d23bbdd2cf
Version merged with the one from CC mode 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
36923
diff
changeset
|
80 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify |
28d23bbdd2cf
Version merged with the one from CC mode 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
36923
diff
changeset
|
81 this GNU Manual, like GNU software. Copies published by the Free |
28d23bbdd2cf
Version merged with the one from CC mode 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
36923
diff
changeset
|
82 Software Foundation raise funds for GNU development.'' |
28d23bbdd2cf
Version merged with the one from CC mode 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
36923
diff
changeset
|
83 |
28d23bbdd2cf
Version merged with the one from CC mode 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
36923
diff
changeset
|
84 This document is part of a collection distributed under the GNU Free |
28d23bbdd2cf
Version merged with the one from CC mode 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
36923
diff
changeset
|
85 Documentation License. If you want to distribute this document |
28d23bbdd2cf
Version merged with the one from CC mode 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
36923
diff
changeset
|
86 separately from the collection, you can do so by adding a copy of the |
28d23bbdd2cf
Version merged with the one from CC mode 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
36923
diff
changeset
|
87 license to the document, as described in section 6 of the license. |
47737
0a70200bde27
use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents:
46918
diff
changeset
|
88 @end quotation |
0a70200bde27
use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents:
46918
diff
changeset
|
89 @end copying |
0a70200bde27
use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents:
46918
diff
changeset
|
90 |
0a70200bde27
use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents:
46918
diff
changeset
|
91 @comment Info directory entry for use by install-info. The indentation |
0a70200bde27
use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents:
46918
diff
changeset
|
92 @comment here is by request from the FSF folks. |
0a70200bde27
use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents:
46918
diff
changeset
|
93 @dircategory Emacs |
0a70200bde27
use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents:
46918
diff
changeset
|
94 @direntry |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
95 * CC Mode: (ccmode). Emacs mode for editing C, C++, Objective-C, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
96 Java, Pike, AWK, and CORBA IDL code. |
47737
0a70200bde27
use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents:
46918
diff
changeset
|
97 @end direntry |
25829 | 98 |
99 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
36923 | 100 @comment TeX title page |
25829 | 101 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
102 | |
103 @titlepage | |
104 @sp 10 | |
105 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
106 @center @titlefont{CC Mode 5.30} |
25829 | 107 @sp 2 |
108 @center @subtitlefont{A GNU Emacs mode for editing C and C-like languages} | |
109 @sp 2 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
110 @center Barry A. Warsaw, Martin Stjernholm, Alan Mackenzie (AWK support) |
25829 | 111 |
112 @page | |
113 @vskip 0pt plus 1filll | |
47737
0a70200bde27
use @copying instead of @ifinfo.
Karl Berry <karl@gnu.org>
parents:
46918
diff
changeset
|
114 @insertcopying |
25829 | 115 @end titlepage |
116 | |
117 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
118 @comment The Top node contains the master menu for the Info file. | |
119 @comment This appears only in the Info file, not the printed manual. | |
120 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
121 | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
122 @node Top, Introduction, (dir), (dir) |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
123 @comment node-name, next, previous, up |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
124 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
125 @macro ccmode |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
126 CC Mode |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
127 @end macro |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
128 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
129 @ifinfo |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
130 @top @ccmode{} |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
131 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
132 @ccmode{} is a GNU Emacs mode for editing files containing C, C++, |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
133 Objective-C, Java, CORBA IDL (and the variants PSDL and CIDL), Pike |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
134 code and to a certain extent, AWK code @xref{AWK Mode}. It provides |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
135 syntax-based indentation, font locking, and has several handy commands |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
136 and some minor modes to make the editing easier. It does not provide |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
137 tools to look up and navigate between functions, classes etc - there are |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
138 other packages for that. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
139 @end ifinfo |
25829 | 140 |
141 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
142 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
143 | |
144 @menu | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
145 * Introduction:: |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
146 * Getting Connected:: |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
147 * Indentation Engine:: |
25829 | 148 * Minor Modes:: |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
149 * Text Filling and Line Breaking:: |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
150 * Macro Handling:: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
151 * Font Locking:: |
25829 | 152 * Commands:: |
153 * Customizing Indentation:: | |
154 * Syntactic Symbols:: | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
155 * Indentation Functions:: |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
156 * AWK Mode:: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
157 * Odds and Ends:: |
25829 | 158 * Performance Issues:: |
36923 | 159 * Limitations and Known Bugs:: |
25829 | 160 * Frequently Asked Questions:: |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
161 * Getting the Latest CC Mode Release:: |
36923 | 162 * Mailing Lists and Submitting Bug Reports:: |
25829 | 163 * Sample .emacs File:: |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
164 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
165 --- Indices --- |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
166 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
167 * Command and Function Index:: |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
168 * Variable Index:: |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
169 * Concept Index:: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
170 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
171 @detailmenu |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
172 --- The Detailed Node Listing --- |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
173 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
174 Indentation Engine |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
175 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
176 * Syntactic Analysis:: |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
177 * Indentation Calculation:: |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
178 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
179 Minor Modes |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
180 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
181 * Auto-newline Insertion:: |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
182 * Hungry-deletion of Whitespace:: |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
183 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
184 Font Locking |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
185 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
186 * Font Locking Preliminaries:: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
187 * Faces:: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
188 * Documentation Comments:: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
189 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
190 Auto-newline Insertion |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
191 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
192 * Hanging Braces:: |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
193 * Hanging Colons:: |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
194 * Hanging Semicolons and Commas:: |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
195 * Other Electric Commands:: |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
196 * Clean-ups:: |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
197 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
198 Commands |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
199 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
200 * Indentation Commands:: |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
201 * Movement Commands:: |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
202 * Other Commands:: |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
203 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
204 Customizing Indentation |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
205 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
206 * Interactive Customization:: |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
207 * Permanent Customization:: |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
208 * Hooks:: |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
209 * Styles:: |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
210 * Advanced Customizations:: |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
211 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
212 Styles |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
213 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
214 * Built-in Styles:: |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
215 * Choosing a Style:: |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
216 * Adding Styles:: |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
217 * File Styles:: |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
218 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
219 Advanced Customizations |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
220 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
221 * Custom Indentation Functions:: |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
222 * Custom Brace and Colon Hanging:: |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
223 * Customizing Semicolons and Commas:: |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
224 * Other Special Indentations:: |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
225 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
226 AWK Mode |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
227 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
228 * Initialising AWK Mode:: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
229 * AWK Mode Font Locking:: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
230 * AWK Mode Defuns:: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
231 @end detailmenu |
25829 | 232 @end menu |
233 | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
234 |
25829 | 235 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
236 @node Introduction, Getting Connected, Top, Top |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
237 @comment node-name, next, previous, up |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
238 @chapter Introduction |
25829 | 239 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
240 | |
241 @cindex BOCM | |
242 | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
243 Welcome to @ccmode{}, a GNU Emacs mode for editing files containing C, |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
244 C++, Objective-C, Java, CORBA IDL (and the variants CORBA PSDL and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
245 CIDL), Pike and to a certain extent, AWK code (@pxref{AWK Mode}). This |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
246 incarnation of the mode is descended from @file{c-mode.el} (also called |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
247 ``Boring Old C Mode'' or BOCM @t{:-)}, and @file{c++-mode.el} version 2, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
248 which Barry has been maintaining since 1992. Late in 1997, Martin |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
249 joined the @ccmode{} Maintainers Team, and implemented the Pike support. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
250 As of 2000 Martin has taken over as the sole maintainer. @ccmode{} did |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
251 not originally contain the font lock support for its languages --- that |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
252 was added in version 5.30. AWK support was also added in 5.30 by Alan |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
253 Mackenzie. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
254 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
255 This manual describes @ccmode{} |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
256 @comment The following line must appear on its own, so that the automated |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
257 version 5.30. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
258 @comment Release.py script can update the version number automatically |
25829 | 259 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
260 @ccmode{} supports the editing of K&R and ANSI C, C++, Objective-C, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
261 Java, CORBA's Interface Definition Language, Pike@footnote{A C-like |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
262 scripting language with its roots in the LPC language used in some MUD |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
263 engines. See @uref{http://pike.ida.liu.se/}.} and AWK files. In this |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
264 way, you can easily set up consistent font locking and coding styles for |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
265 use in editing all of these languages, although AWK is not yet as |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
266 uniformly integrated as the other languages. |
25829 | 267 |
268 @findex c-mode | |
269 @findex c++-mode | |
270 @findex objc-mode | |
271 @findex java-mode | |
272 @findex idl-mode | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
273 @findex pike-mode |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
274 @findex awk-mode |
36924
28d23bbdd2cf
Version merged with the one from CC mode 5.28.
Gerd Moellmann <gerd@gnu.org>
parents:
36923
diff
changeset
|
275 Note that the name of this package is ``@ccmode{},'' but there is no top |
25829 | 276 level @code{cc-mode} entry point. All of the variables, commands, and |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
277 functions in @ccmode{} are prefixed with @code{c-@var{thing}}, and |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
278 @code{c-mode}, @code{c++-mode}, @code{objc-mode}, @code{java-mode}, |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
279 @code{idl-mode}, @code{pike-mode}, and @code{awk-mode} entry points are |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
280 provided. This package is intended to be a replacement for |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
281 @file{c-mode.el}, @file{c++-mode.el} and @file{awk-mode.el}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
282 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
283 @c @cindex @file{cc-compat.el} file |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
284 @c This distribution also contains a file |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
285 @c called @file{cc-compat.el} which should ease your transition from BOCM |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
286 @c to @ccmode{}. If you have a BOCM configuration you are really happy |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
287 @c with, and want to postpone learning how to configure @ccmode{}, take a |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
288 @c look at that file. It maps BOCM configuration variables to @ccmode{}'s |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
289 @c indentation model. It is not actively supported so for the long run, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
290 @c you should learn how to customize @ccmode{} to support your coding |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
291 @c style. |
25829 | 292 |
293 A special word of thanks goes to Krishna Padmasola for his work in | |
294 converting the original @file{README} file to Texinfo format. I'd also | |
295 like to thank all the @ccmode{} victims who help enormously during the | |
296 early beta stages of @ccmode{}'s development. | |
297 | |
298 | |
299 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
300 @node Getting Connected, Indentation Engine, Introduction, Top |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
301 @comment node-name, next, previous, up |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
302 @chapter Getting Connected |
25829 | 303 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
304 | |
305 If you got this version of @ccmode{} with Emacs or XEmacs, it should | |
306 work just fine right out of the box. Note however that you may not have | |
307 the latest @ccmode{} release and may want to upgrade your copy. | |
308 | |
309 If you are upgrading an existing @ccmode{} installation, please see the | |
310 @file{README} file for installation details. @ccmode{} may not work | |
311 with older versions of Emacs or XEmacs. See the @ccmode{} release notes | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
312 at @uref{http://cc-mode.sourceforge.net} for the latest information on |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
313 Emacs version and package compatibility (@pxref{Getting the Latest CC |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
314 Mode Release}). |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
315 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
316 @deffn Command c-version |
25829 | 317 @findex version (c-) |
318 You can find out what version of @ccmode{} you are using by visiting a C | |
319 file and entering @kbd{M-x c-version RET}. You should see this message in | |
320 the echo area: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
321 |
25829 | 322 @example |
323 Using CC Mode version 5.XX | |
324 @end example | |
325 | |
326 @noindent | |
327 where @samp{XX} is the minor release number. | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
328 @end deffn |
25829 | 329 |
330 | |
331 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
332 @node Indentation Engine, Minor Modes, Getting Connected, Top |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
333 @comment node-name, next, previous, up |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
334 @chapter Indentation Engine |
25829 | 335 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
336 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
337 @ccmode{} has an indentation engine that provides a flexible and general |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
338 mechanism for customizing indentation. It separates indentation |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
339 calculation into two steps: first, @ccmode{} analyzes the line of code |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
340 being indented to determine the kind of language construct it's looking |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
341 at, then it applies user defined offsets to the current line based on |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
342 this analysis. |
25829 | 343 |
344 This section will briefly cover how indentation is calculated in | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
345 @ccmode{}. It is important to understand the indentation model being |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
346 used so that you will know how to customize @ccmode{} for your personal |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
347 coding style. All the details are in @ref{Customizing Indentation}, and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
348 later chapters. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
349 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
350 @defopt c-syntactic-indentation |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
351 @vindex syntactic-indentation (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
352 Syntactic analysis for indentation is done when this is non-@code{nil} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
353 (which is the default). When it's @code{nil} every line is just |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
354 indented to the same level as the previous one, and @kbd{TAB} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
355 (@code{c-indent-command}) adjusts the indentation in steps of |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
356 @code{c-basic-offset}. The indentation style has no effect, nor any of |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
357 the indentation associated variables, e.g., @code{c-special-indent-hook}. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
358 @end defopt |
25829 | 359 |
360 @menu | |
361 * Syntactic Analysis:: | |
362 * Indentation Calculation:: | |
363 @end menu | |
364 | |
365 | |
366 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
367 @node Syntactic Analysis, Indentation Calculation, , Indentation Engine |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
368 @comment node-name, next, previous, up |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
369 @section Syntactic Analysis |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
370 @cindex syntactic analysis |
25829 | 371 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
372 | |
373 @cindex relative buffer position | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
374 @cindex syntactic symbols |
25829 | 375 @cindex syntactic component |
376 @cindex syntactic component list | |
377 The first thing @ccmode{} does when indenting a line of code, is to | |
378 analyze the line, determining the @dfn{syntactic component list} of the | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
379 construct on that line. A syntactic component consists of a pair of |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
380 elements (in lisp parlance, a @emph{cons cell}), the first being |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
381 a @dfn{syntactic symbol}, the second being a @dfn{relative |
25829 | 382 buffer position}. Syntactic symbols describe elements of C code |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
383 @footnote{Unless otherwise noted, the term ``C code'' refers to all |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
384 the C-like languages.}, e.g., @code{statement}, @code{substatement}, |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
385 @code{class-open}, @code{class-close}, etc. @xref{Syntactic Symbols}, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
386 for a complete list of currently recognized syntactic symbols and their |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
387 semantics. The style variable @code{c-offsets-alist} also contains the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
388 list of currently supported syntactic symbols. |
25829 | 389 |
390 Conceptually, a line of C code is always indented relative to the | |
391 indentation of some line higher up in the buffer. This is represented | |
392 by the relative buffer position in the syntactic component. | |
393 | |
394 Here is an example. Suppose we had the following code as the only thing | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
395 in a C++ buffer @footnote{The line numbers in this and future examples |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
396 don't actually appear in the buffer, of course!}: |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
397 |
25829 | 398 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
399 1: void swap( int& a, int& b ) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
400 2: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
401 3: int tmp = a; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
402 4: a = b; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
403 5: b = tmp; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
404 6: @} |
25829 | 405 @end example |
406 | |
407 @kindex C-c C-s | |
408 @findex c-show-syntactic-information | |
409 @findex show-syntactic-information (c-) | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
410 We can use the command @kbd{C-c C-s} (bound to |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
411 @code{c-show-syntactic-information}) to simply report what the |
25829 | 412 syntactic analysis is for the current line. Running this command on |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
413 line 4 of this example, we'd see in the echo area@footnote{With a |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
414 universal argument (i.e., @kbd{C-u C-c C-s}) the analysis is inserted |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
415 into the buffer as a comment on the current line.}: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
416 |
25829 | 417 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
418 ((statement 35)) |
25829 | 419 @end example |
420 | |
421 This tells us that the line is a statement and it is indented relative | |
422 to buffer position 35, which happens to be the @samp{i} in @code{int} on | |
423 line 3. If you were to move point to line 3 and hit @kbd{C-c C-s}, you | |
424 would see: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
425 |
25829 | 426 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
427 ((defun-block-intro 29)) |
25829 | 428 @end example |
429 | |
430 This indicates that the @samp{int} line is the first statement in a top | |
431 level function block, and is indented relative to buffer position 29, | |
432 which is the brace just after the function header. | |
433 | |
434 Here's another example: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
435 |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47737
diff
changeset
|
436 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
437 1: int add( int val, int incr, int doit ) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
438 2: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
439 3: if( doit ) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
440 4: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
441 5: return( val + incr ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
442 6: @} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
443 7: return( val ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
444 8: @} |
25829 | 445 @end example |
446 | |
447 @noindent | |
448 Hitting @kbd{C-c C-s} on line 4 gives us: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
449 |
25829 | 450 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
451 ((substatement-open 46)) |
25829 | 452 @end example |
453 | |
454 @cindex substatement | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
455 @cindex substatement block |
25829 | 456 @noindent |
457 which tells us that this is a brace that @emph{opens} a substatement | |
458 block. @footnote{A @dfn{substatement} is the line after a | |
459 conditional statement, such as @code{if}, @code{else}, @code{while}, | |
460 @code{do}, @code{switch}, etc. A @dfn{substatement | |
461 block} is a brace block following one of these conditional statements.} | |
462 | |
463 @cindex comment-only line | |
464 Syntactic component lists can contain more than one component, and | |
465 individual syntactic components need not have relative buffer positions. | |
466 The most common example of this is a line that contains a @dfn{comment | |
467 only line}. | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
468 |
25829 | 469 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
470 1: void draw_list( List<Drawables>& drawables ) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
471 2: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
472 3: // call the virtual draw() method on each element in list |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
473 4: for( int i=0; i < drawables.count(), ++i ) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
474 5: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
475 6: drawables[i].draw(); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
476 7: @} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
477 8: @} |
25829 | 478 @end example |
479 | |
480 @noindent | |
481 Hitting @kbd{C-c C-s} on line 3 of this example gives: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
482 |
25829 | 483 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
484 ((comment-intro) (defun-block-intro 46)) |
25829 | 485 @end example |
486 | |
487 @noindent | |
488 and you can see that the syntactic component list contains two syntactic | |
489 components. Also notice that the first component, | |
490 @samp{(comment-intro)} has no relative buffer position. | |
491 | |
492 | |
493 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
494 @node Indentation Calculation, , Syntactic Analysis, Indentation Engine |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
495 @comment node-name, next, previous, up |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
496 @section Indentation Calculation |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
497 @cindex indentation |
25829 | 498 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
499 | |
500 Indentation for a line is calculated using the syntactic | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
501 component list derived in step 1 above (@pxref{Syntactic Analysis}). |
25829 | 502 Each component contributes to the final total indentation of the line in |
503 two ways. | |
504 | |
505 First, the syntactic symbols are looked up in the @code{c-offsets-alist} | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
506 style variable, which is an association list of syntactic symbols and |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
507 the offsets to apply for those symbols. These offsets are added to a |
25829 | 508 running total. |
509 | |
510 Second, if the component has a relative buffer position, @ccmode{} | |
511 adds the column number of that position to the running total. By adding | |
512 up the offsets and columns for every syntactic component on the list, | |
513 the final total indentation for the current line is computed. | |
514 | |
515 Let's use our two code examples above to see how this works. Here is | |
516 our first example again: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
517 |
25829 | 518 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
519 1: void swap( int& a, int& b ) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
520 2: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
521 3: int tmp = a; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
522 4: a = b; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
523 5: b = tmp; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
524 6: @} |
25829 | 525 @end example |
526 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
527 Let's say point is on line 3 and we hit the @kbd{TAB} key to reindent |
25829 | 528 the line. Remember that the syntactic component list for that |
529 line is: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
530 |
25829 | 531 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
532 ((defun-block-intro 29)) |
25829 | 533 @end example |
534 | |
535 @noindent | |
536 @ccmode{} looks up @code{defun-block-intro} in the | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
537 @code{c-offsets-alist} style variable. Let's say it finds the value |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
538 @samp{4}; it adds this to the running total (initialized to zero), |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
539 yielding a running total indentation of 4 spaces. |
25829 | 540 |
541 Next @ccmode{} goes to buffer position 29 and asks for the current | |
542 column. This brace is in column zero, so @ccmode{} | |
543 adds @samp{0} to the running total. Since there is only one syntactic | |
544 component on the list for this line, indentation calculation is | |
545 complete, and the total indentation for the line | |
546 is 4 spaces. | |
547 | |
548 Here's another example: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
549 |
25829 | 550 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
551 1: int add( int val, int incr, int doit ) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
552 2: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
553 3: if( doit ) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
554 4: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
555 5: return( val + incr ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
556 6: @} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
557 7: return( val ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
558 8: @} |
25829 | 559 @end example |
560 | |
561 If we were to hit @kbd{TAB} on line 4 in the above example, the same | |
562 basic process is performed, despite the differences in the syntactic | |
563 component list. Remember that the list for this line is: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
564 |
25829 | 565 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
566 ((substatement-open 46)) |
25829 | 567 @end example |
568 | |
569 Here, @ccmode{} first looks up the @code{substatement-open} symbol | |
570 in @code{c-offsets-alist}. Let's say it finds the value @samp{4}. This | |
571 yields a running total of 4. @ccmode{} then goes to | |
572 buffer position 46, which is the @samp{i} in @code{if} on line 3. This | |
573 character is in the fourth column on that line so adding this to the | |
574 running total yields an indentation for the line of 8 spaces. | |
575 | |
576 Simple, huh? | |
577 | |
578 Actually, the mode usually just does The Right Thing without you having | |
579 to think about it in this much detail. But when customizing | |
580 indentation, it's helpful to understand the general indentation model | |
581 being used. | |
582 | |
583 As you configure @ccmode{}, you might want to set the variable | |
584 @code{c-echo-syntactic-information-p} to non-@code{nil} so that the | |
585 syntactic component list and calculated offset will always be echoed in | |
586 the minibuffer when you hit @kbd{TAB}. | |
587 | |
588 | |
589 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
590 @node Minor Modes, Text Filling and Line Breaking, Indentation Engine, Top |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
591 @comment node-name, next, previous, up |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
592 @chapter Minor Modes |
25829 | 593 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
594 | |
595 @ccmode{} contains two minor-mode-like features that you should | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
596 find useful while entering new C code. The first is called |
25829 | 597 @dfn{auto-newline} mode, and the second is called @dfn{hungry-delete} |
598 mode. These minor modes can be toggled on and off independently, and | |
599 @ccmode{} can be configured so that it starts up with any | |
600 combination of these minor modes. By default, both of these minor modes | |
601 are turned off. | |
602 | |
603 The state of the minor modes is always reflected in the minor mode list | |
604 on the modeline of the @ccmode{} buffer. When auto-newline mode is | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
605 enabled, you will see @samp{C/a} on the mode line@footnote{The @samp{C} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
606 would be replaced with the name of the language in question for the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
607 other languages @ccmode{} supports.}. When hungry delete mode is |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
608 enabled you will see @samp{C/h} and if both modes were enabled, you'd |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
609 see @samp{C/ah}. |
25829 | 610 |
611 @kindex C-c C-a | |
612 @kindex C-c C-d | |
613 @kindex C-c C-t | |
614 @findex c-toggle-hungry-state | |
615 @findex c-toggle-auto-state | |
616 @findex c-toggle-auto-hungry-state | |
617 @findex toggle-hungry-state (c-) | |
618 @findex toggle-auto-state (c-) | |
619 @findex toggle-auto-hungry-state (c-) | |
39267 | 620 @ccmode{} provides key bindings which allow you to toggle the minor |
25829 | 621 modes on the fly while editing code. To toggle just the auto-newline |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
622 state, hit @kbd{C-c C-a} (bound to @code{c-toggle-auto-state}). When |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
623 you do this, you should see the @samp{a} indicator either appear or |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
624 disappear on the modeline. Similarly, to toggle just the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
625 hungry-delete state, use @kbd{C-c C-d} (@code{c-toggle-hungry-state}), |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
626 and to toggle both states, use @kbd{C-c C-t} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
627 (@code{c-toggle-auto-hungry-state}). |
25829 | 628 |
629 To set up the auto-newline and hungry-delete states to your preferred | |
630 values, you would need to add some lisp to your @file{.emacs} file that | |
631 called one of the @code{c-toggle-*-state} functions directly. When | |
632 called programmatically, each function takes a numeric value, where | |
633 a positive number enables the minor mode, a negative number disables the | |
634 mode, and zero toggles the current state of the mode. | |
635 | |
636 So for example, if you wanted to enable both auto-newline and | |
637 hungry-delete for all your C file editing, you could add the following | |
638 to your @file{.emacs} file: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
639 |
25829 | 640 @example |
641 (add-hook 'c-mode-common-hook | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
642 (lambda () (c-toggle-auto-hungry-state 1))) |
25829 | 643 @end example |
644 | |
645 @menu | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
646 * Auto-newline Insertion:: |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
647 * Hungry-deletion of Whitespace:: |
25829 | 648 @end menu |
649 | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
650 |
25829 | 651 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
652 @node Auto-newline Insertion, Hungry-deletion of Whitespace, , Minor Modes |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
653 @comment node-name, next, previous, up |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
654 @section Auto-newline Insertion |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
655 @cindex auto-newline |
25829 | 656 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
657 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
658 @cindex electric characters |
25829 | 659 Auto-newline minor mode works by enabling certain @dfn{electric |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
660 characters}. Special characters such as the left and right braces, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
661 colons, semicolons, etc., have been made electric to perform some |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
662 magic formatting in addition to inserting the typed character. As a |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
663 general rule, electric characters are only electric when the following |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
664 conditions apply: |
25829 | 665 |
666 @itemize @bullet | |
667 @item | |
668 Auto-newline minor mode is enabled, as evidenced by a @samp{C/a} or | |
669 @samp{C/ah} indicator on the modeline. | |
670 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
671 @item |
25829 | 672 @cindex literal |
673 @cindex syntactic whitespace | |
674 The character was not typed inside of a literal @footnote{A | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
675 @dfn{literal} is defined as any comment, string, or preprocessor macro |
25829 | 676 definition. These constructs are also known as @dfn{syntactic |
677 whitespace} since they are usually ignored when scanning C code.}. | |
678 | |
679 @item | |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
680 No numeric argument was supplied to the command (i.e., it was typed as |
25829 | 681 normal, with no @kbd{C-u} prefix). |
682 @end itemize | |
683 | |
684 @menu | |
685 * Hanging Braces:: | |
686 * Hanging Colons:: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
687 * Hanging Semicolons and Commas:: |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
688 * Other Electric Commands:: |
25829 | 689 * Clean-ups:: |
690 @end menu | |
691 | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
692 |
25829 | 693 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
694 @node Hanging Braces, Hanging Colons, , Auto-newline Insertion |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
695 @comment node-name, next, previous, up |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
696 @subsection Hanging Braces |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
697 @cindex hanging braces |
25829 | 698 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
699 | |
700 @findex c-electric-brace | |
701 @findex electric-brace (c-) | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
702 @kindex @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
703 @kindex @} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
704 |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
705 When you type either an open or close brace (i.e., @kbd{@{} or @kbd{@}}), |
25829 | 706 the electric command @code{c-electric-brace} gets run. This command has |
707 two electric formatting behaviors. First, it will perform some | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
708 reindentation of the line the brace was typed on, and second, it will |
25829 | 709 add various newlines before and/or after the typed brace. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
710 Reindentation occurs automatically whenever the electric behavior is |
25829 | 711 enabled. If the brace ends up on a line other than the one it was typed |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
712 on, then that line is also reindented. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
713 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
714 The default in auto-newline mode is to insert newlines both before and |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
715 after a brace, but that can be controlled by the |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
716 @code{c-hanging-braces-alist} style variable. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
717 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
718 @defopt c-hanging-braces-alist |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
719 @vindex hanging-braces-alist (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
720 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
721 This variable contains a mapping between syntactic symbols related to |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
722 braces, and a list of places to insert a newline. The syntactic symbols |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
723 that are useful for this list are @code{brace-list-intro}, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
724 @code{statement-cont}, @code{inexpr-class-open}, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
725 @code{inexpr-class-close}, and all the @code{*-open} and @code{*-close} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
726 symbols. @xref{Syntactic Symbols}, for a more detailed description of |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
727 these syntactic symbols, except for @code{inexpr-class-open} and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
728 @code{inexpr-class-close}, which aren't actual syntactic symbols. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
729 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
730 The braces of anonymous inner classes in Java are given the special |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
731 symbols @code{inexpr-class-open} and @code{inexpr-class-close}, so that |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
732 they can be distinguished from the braces of normal classes@footnote{The |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
733 braces of anonymous classes produce a combination of |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
734 @code{inexpr-class}, and @code{class-open} or @code{class-close} in |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
735 normal indentation analysis.}. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
736 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
737 Note that the aggregate constructs in Pike mode, @samp{(@{}, @samp{@})}, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
738 @samp{([}, @samp{])}, and @samp{(<}, @samp{>)}, do not count as brace |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
739 lists in this regard, even though they do for normal indentation |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
740 purposes. It's currently not possible to set automatic newlines on |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
741 these constructs. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
742 |
25829 | 743 The value associated with each syntactic symbol in this association list |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
744 is called an @var{action}, which can be either a function or a list. |
26490
2b08d829af86
Fix complaints from makeinfo 4.0.
Eli Zaretskii <eliz@gnu.org>
parents:
25829
diff
changeset
|
745 @xref{Custom Brace and Colon Hanging}, for a more detailed discussion of |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
746 using a function as a brace hanging @var{action}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
747 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
748 When the @var{action} is a list, it can contain any combination of the |
25829 | 749 symbols @code{before} and @code{after}, directing @ccmode{} where to |
750 put newlines in relationship to the brace being inserted. Thus, if the | |
751 list contains only the symbol @code{after}, then the brace is said to | |
752 @dfn{hang} on the right side of the line, as in: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
753 |
25829 | 754 @example |
755 // here, open braces always `hang' | |
756 void spam( int i ) @{ | |
757 if( i == 7 ) @{ | |
758 dosomething(i); | |
759 @} | |
760 @} | |
761 @end example | |
762 | |
763 When the list contains both @code{after} and @code{before}, the braces | |
764 will appear on a line by themselves, as shown by the close braces in the | |
765 above example. The list can also be empty, in which case no newlines | |
766 are added either before or after the brace. | |
767 | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
768 If a syntactic symbol is missing entirely from |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
769 @code{c-hanging-braces-alist}, it's treated in the same way as an |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
770 @var{action} with a list containing @code{before} and @code{after}, so |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
771 that braces by default end up on their own line. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
772 |
25829 | 773 For example, the default value of @code{c-hanging-braces-alist} is: |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
774 |
25829 | 775 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
776 ((brace-list-open) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
777 (brace-entry-open) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
778 (statement-cont) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
779 (substatement-open after) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
780 (block-close . c-snug-do-while) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
781 (extern-lang-open after) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
782 (inexpr-class-open after) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
783 (inexpr-class-close before)) |
25829 | 784 @end example |
785 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
786 @noindent which says that @code{brace-list-open}, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
787 @code{brace-entry-open} and @code{statement-cont}@footnote{Brace lists |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
788 inside statements, such as initializers for static array variables |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
789 inside functions in C, are recognized as @code{statement-cont}. All |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
790 normal substatement blocks are recognized with other symbols.} braces |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
791 should both hang on the right side and allow subsequent text to follow |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
792 on the same line as the brace. Also, @code{substatement-open}, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
793 @code{extern-lang-open}, and @code{inexpr-class-open} braces should hang |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
794 on the right side, but subsequent text should follow on the next line. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
795 The opposite holds for @code{inexpr-class-close} braces; they won't |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
796 hang, but the following text continues on the same line. Here, in the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
797 @code{block-close} entry, you also see an example of using a function as |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
798 an @var{action}. In all other cases, braces are put on a line by |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
799 themselves. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
800 @end defopt |
25829 | 801 |
802 | |
803 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
804 @node Hanging Colons, Hanging Semicolons and Commas, Hanging Braces, Auto-newline Insertion |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
805 @comment node-name, next, previous, up |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
806 @subsection Hanging Colons |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
807 @cindex hanging colons |
25829 | 808 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
809 | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
810 Using a mechanism similar to brace hanging (@pxref{Hanging Braces}), |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
811 colons can also be made to hang using the style variable |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
812 @code{c-hanging-colons-alist}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
813 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
814 @defopt c-hanging-colons-alist |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
815 @vindex hanging-colons-alist (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
816 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
817 The syntactic symbols appropriate for this association list are: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
818 @code{case-label}, @code{label}, @code{access-label}, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
819 @code{member-init-intro}, and @code{inher-intro}. Note however that for |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
820 @code{c-hanging-colons-alist}, @var{action}s as functions are not |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
821 supported. See also @ref{Custom Brace and Colon Hanging} for details. |
25829 | 822 |
823 In C++, double-colons are used as a scope operator but because these | |
824 colons always appear right next to each other, newlines before and after | |
825 them are controlled by a different mechanism, called @dfn{clean-ups} in | |
26490
2b08d829af86
Fix complaints from makeinfo 4.0.
Eli Zaretskii <eliz@gnu.org>
parents:
25829
diff
changeset
|
826 @ccmode{}. @xref{Clean-ups}, for details. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
827 @end defopt |
25829 | 828 |
829 | |
830 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
831 @node Hanging Semicolons and Commas, Other Electric Commands, Hanging Colons, Auto-newline Insertion |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
832 @comment node-name, next, previous, up |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
833 @subsection Hanging Semicolons and Commas |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
834 @cindex hanging semicolons |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
835 @cindex hanging commas |
25829 | 836 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
837 | |
838 Semicolons and commas are also electric in @ccmode{}, but since | |
839 these characters do not correspond directly to syntactic symbols, a | |
840 different mechanism is used to determine whether newlines should be | |
841 automatically inserted after these characters. @xref{Customizing | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
842 Semicolons and Commas}, for details. |
25829 | 843 |
844 | |
845 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
846 @node Other Electric Commands, Clean-ups, Hanging Semicolons and Commas, Auto-newline Insertion |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
847 @comment node-name, next, previous, up |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
848 @subsection Other Electric Commands |
25829 | 849 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
850 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
851 A few other keys also provide electric behavior, often only to reindent |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
852 the line. Common to all of them is that they only reindent if used in |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
853 normal code (as opposed to in a string literal or comment), and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
854 @code{c-syntactic-indentation} isn't @code{nil}. They are: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
855 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
856 @table @kbd |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
857 @item # |
25829 | 858 @kindex # |
859 @findex c-electric-pound | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
860 @findex electric-pound (c-) |
25829 | 861 @vindex c-electric-pound-behavior |
862 @vindex electric-pound-behavior (c-) | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
863 Pound (bound to @code{c-electric-pound}) is electric when typed as the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
864 first non-whitespace character on a line and not within a macro |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
865 definition. In this case, the variable @code{c-electric-pound-behavior} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
866 is consulted for the electric behavior. This variable takes a list |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
867 value, although the only element currently defined is @code{alignleft}, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
868 which tells this command to force the @samp{#} character into column |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
869 zero. This is useful for entering preprocessor macro definitions. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
870 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
871 Pound is not electric in AWK buffers, where @samp{#} starts a comment, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
872 and is bound to @code{self-insert-command} like any typical printable |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
873 character. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
874 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
875 @item * |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
876 @kindex * |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
877 @itemx / |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
878 @kindex / |
25829 | 879 @findex c-electric-star |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
880 @findex electric-star (c-) |
25829 | 881 @findex c-electric-slash |
882 @findex electric-slash (c-) | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
883 Stars and slashes (bound to @code{c-electric-star} and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
884 @code{c-electric-slash} respectively) are also electric under certain |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
885 circumstances. If a @samp{*} is inserted as the second character of a C |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
886 style block comment on a comment-only line, then the comment delimiter |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
887 is indented as defined by @code{c-offsets-alist}. A comment-only line |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
888 is defined as a line which contains only a comment, as in: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
889 |
25829 | 890 @example |
891 @group | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47737
diff
changeset
|
892 void spam( int i ) |
25829 | 893 @{ |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
894 // this is a comment-only line... |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
895 if( i == 7 ) // but this is not |
25829 | 896 @{ |
897 dosomething(i); | |
898 @} | |
899 @} | |
900 @end group | |
901 @end example | |
902 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
903 Likewise, if a @samp{/} is inserted as the second slash in a C++ style |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
904 line comment (also only on a comment-only line), then the line is |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
905 indented as defined by @code{c-offsets-alist}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
906 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
907 In AWK mode, @samp{*} and @samp{/} do not delimit comments and are |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
908 bound to @code{self-insert-command}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
909 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
910 @item < |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
911 @kindex < |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
912 @itemx > |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
913 @kindex > |
25829 | 914 @findex c-electric-lt-gt |
915 @findex electric-lt-gt (c-) | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
916 Less-than and greater-than signs (bound to @code{c-electric-lt-gt}) are |
25829 | 917 electric, but only in C++ mode. Hitting the second of two @kbd{<} or |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
918 @kbd{>} keys reindents the line if it is a C++ style stream operator. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
919 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
920 @item ( |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
921 @kindex ( |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
922 @itemx ) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
923 @kindex ) |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
924 @findex c-electric-paren |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
925 @findex electric-paren (c-) |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
926 The normal parenthesis characters @samp{(} and @samp{)} reindent the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
927 current line. This is useful for getting the closing parenthesis of an |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
928 argument list aligned automatically. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
929 @end table |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
930 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
931 @deffn Command c-electric-continued-statement |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
932 @findex electric-continued-statement (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
933 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
934 Certain keywords, depending on language, are electric to cause |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
935 reindentation when they are preceded only by whitespace on the line. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
936 The keywords are those that continue an earlier statement instead of |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
937 starting a new one: @code{else}, @code{while}, @code{catch} (only in C++ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
938 and Java) and @code{finally} (only in Java). |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
939 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
940 An example: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
941 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
942 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
943 @group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
944 for (i = 0; i < 17; i++) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
945 if (a[i]) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
946 res += a[i]->offset; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
947 else |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
948 @end group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
949 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
950 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
951 Here, the @code{else} should be indented like the preceding @code{if}, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
952 since it continues that statement. @ccmode{} will automatically reindent |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
953 it after the @code{else} has been typed in full, since it's not until |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
954 then it's possible to decide whether it's a new statement or a |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
955 continuation of the preceding @code{if}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
956 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
957 @vindex abbrev-mode |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
958 @findex abbrev-mode |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
959 @cindex Abbrev mode |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
960 @ccmode{} uses Abbrev mode (@pxref{Abbrevs,,, emacs, The Emacs Editor}) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
961 to accomplish this. It's therefore turned on by default in all language |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
962 modes except IDL mode, since CORBA IDL doesn't have any statements. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
963 @end deffn |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
964 |
25829 | 965 |
966 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
967 @node Clean-ups, , Other Electric Commands, Auto-newline Insertion |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
968 @comment node-name, next, previous, up |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
969 @subsection Clean-ups |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
970 @cindex clean-ups |
25829 | 971 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
972 | |
36923 | 973 @dfn{Clean-ups} are mechanisms complementary to colon and brace hanging. |
974 On the surface, it would seem that clean-ups overlap the functionality | |
975 provided by the @code{c-hanging-*-alist} variables. Clean-ups are | |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
976 however used to adjust code ``after-the-fact,'' i.e., to adjust the |
36923 | 977 whitespace in constructs after they are typed. |
978 | |
979 Most of the clean-ups are only applicable to counteract automatically | |
980 inserted newlines, and will therefore only have any effect if the | |
981 auto-newline minor mode is turned on. Others will work all the time. | |
25829 | 982 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
983 @defopt c-cleanup-list |
25829 | 984 @vindex cleanup-list (c-) |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
985 @cindex literal |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
986 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
987 You can configure @ccmode{}'s clean-ups by setting the style variable |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
988 @code{c-cleanup-list}, which is a list of clean-up symbols. By default, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
989 @ccmode{} cleans up only the @code{scope-operator} construct, which is |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
990 necessary for proper C++ support. Note that clean-ups are only |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
991 performed when the construct does not occur within a literal |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
992 (@pxref{Auto-newline Insertion}), and when there is nothing but |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
993 whitespace appearing between the individual components of the construct. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
994 @end defopt |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
995 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
996 These are the clean-ups that are only active in the auto-newline minor |
36923 | 997 mode: |
25829 | 998 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
999 @c TBD: Would like to use some sort of @deffoo here; @table indents a |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1000 @c bit too much in dvi output. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1001 @table @code |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1002 @item brace-else-brace |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1003 Clean up @samp{@} else @{} constructs by placing the entire construct on |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1004 a single line. Clean-up occurs when the open brace after the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1005 @samp{else} is typed. So for example, this: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1006 |
25829 | 1007 @example |
1008 @group | |
1009 void spam(int i) | |
1010 @{ | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1011 if( i==7 ) @{ |
25829 | 1012 dosomething(); |
1013 @} | |
1014 else | |
1015 @{ | |
1016 @end group | |
1017 @end example | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1018 |
25829 | 1019 @noindent |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1020 appears like this after the last open brace is typed: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1021 |
25829 | 1022 @example |
1023 @group | |
1024 void spam(int i) | |
1025 @{ | |
1026 if( i==7 ) @{ | |
1027 dosomething(); | |
1028 @} else @{ | |
1029 @end group | |
1030 @end example | |
1031 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1032 @item brace-elseif-brace |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1033 Similar to the @code{brace-else-brace} clean-up, but this cleans up |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1034 @samp{@} else if (...) @{} constructs. For example: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1035 |
25829 | 1036 @example |
1037 @group | |
1038 void spam(int i) | |
1039 @{ | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1040 if( i==7 ) @{ |
25829 | 1041 dosomething(); |
1042 @} | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1043 else if( i==3 ) |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1044 @{ |
25829 | 1045 @end group |
1046 @end example | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1047 |
25829 | 1048 @noindent |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1049 appears like this after the last open parenthesis is typed: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1050 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1051 @example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1052 @group |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1053 void spam(int i) |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1054 @{ |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1055 if( i==7 ) @{ |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1056 dosomething(); |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1057 @} else if( i==3 ) |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1058 @{ |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1059 @end group |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1060 @end example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1061 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1062 @noindent |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1063 and like this after the last open brace is typed: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1064 |
25829 | 1065 @example |
1066 @group | |
1067 void spam(int i) | |
1068 @{ | |
1069 if( i==7 ) @{ | |
1070 dosomething(); | |
1071 @} else if( i==3 ) @{ | |
1072 @end group | |
1073 @end example | |
1074 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1075 @item brace-catch-brace |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1076 Analogous to @code{brace-elseif-brace}, but cleans up @samp{@} catch |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1077 (...) @{} in C++ and Java mode. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1078 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1079 @item empty-defun-braces |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1080 Clean up braces following a top-level function or class definition that |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1081 contains no body. Clean up occurs when the closing brace is typed. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1082 Thus the following: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1083 |
25829 | 1084 @example |
1085 @group | |
1086 class Spam | |
1087 @{ | |
1088 @} | |
1089 @end group | |
1090 @end example | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1091 |
25829 | 1092 @noindent |
1093 is transformed into this when the close brace is typed: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1094 |
25829 | 1095 @example |
1096 @group | |
1097 class Spam | |
1098 @{@} | |
1099 @end group | |
1100 @end example | |
1101 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1102 @item defun-close-semi |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1103 Clean up the terminating semicolon on top-level function or class |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1104 definitions when they follow a close brace. Clean up occurs when the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1105 semicolon is typed. So for example, the following: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1106 |
25829 | 1107 @example |
1108 @group | |
1109 class Spam | |
1110 @{ | |
1111 @} | |
1112 ; | |
1113 @end group | |
1114 @end example | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1115 |
25829 | 1116 @noindent |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1117 is transformed into this when the semicolon is typed: |
25829 | 1118 |
1119 @example | |
1120 @group | |
1121 class Spam | |
1122 @{ | |
1123 @}; | |
1124 @end group | |
1125 @end example | |
1126 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1127 @item list-close-comma |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1128 Clean up commas following braces in array and aggregate initializers. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1129 Clean up occurs when the comma is typed. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1130 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1131 @item scope-operator |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1132 Clean up double colons which may designate a C++ scope operator split |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1133 across multiple lines@footnote{Certain C++ constructs introduce |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1134 ambiguous situations, so @code{scope-operator} clean-ups may not always |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1135 be correct. This usually only occurs when scoped identifiers appear in |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1136 switch label tags.}. Clean up occurs when the second colon is typed. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1137 You will always want @code{scope-operator} in the @code{c-cleanup-list} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1138 when you are editing C++ code. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1139 @end table |
25829 | 1140 |
36923 | 1141 The following clean-ups are always active when they occur on |
1142 @code{c-cleanup-list}, and are thus not affected by the auto-newline | |
1143 minor mode: | |
1144 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1145 @table @code |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1146 @item space-before-funcall |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1147 Insert a space between the function name and the opening parenthesis of |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1148 a function call. This produces function calls in the style mandated by |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
1149 the GNU coding standards, e.g., @samp{signal (SIGINT, SIG_IGN)} and |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1150 @samp{abort ()}. Clean up occurs when the opening parenthesis is typed. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1151 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1152 @item compact-empty-funcall |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1153 Clean up any space between the function name and the opening parenthesis |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1154 of a function call that has no arguments. This is typically used |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1155 together with @code{space-before-funcall} if you prefer the GNU function |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1156 call style for functions with arguments but think it looks ugly when |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
1157 it's only an empty parenthesis pair. I.e., you will get @samp{signal |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1158 (SIGINT, SIG_IGN)}, but @samp{abort()}. Clean up occurs when the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1159 closing parenthesis is typed. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1160 @end table |
36923 | 1161 |
25829 | 1162 |
1163 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1164 @node Hungry-deletion of Whitespace, , Auto-newline Insertion, Minor Modes |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1165 @comment node-name, next, previous, up |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1166 @section Hungry-deletion of Whitespace |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1167 @cindex hungry-deletion |
25829 | 1168 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
1169 | |
1170 Hungry deletion of whitespace, or as it more commonly called, | |
1171 @dfn{hungry-delete mode}, is a simple feature that some people find | |
1172 extremely useful. In fact, you might find yourself wanting | |
1173 hungry-delete in @strong{all} your editing modes! | |
1174 | |
1175 @kindex DEL | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1176 @kindex C-d |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1177 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1178 In a nutshell, when hungry-delete mode is enabled, hitting the @kbd{DEL} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1179 or @kbd{C-d} keys will consume all preceding or following whitespace, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1180 including newlines and tabs. This can really cut down on the number of |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1181 times you have to hit these keys if, for example, you made a mistake on |
25829 | 1182 the preceding line. |
1183 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1184 @deffn Command c-electric-backspace |
25829 | 1185 @findex electric-backspace (c-) |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1186 This command is run by default when you hit the @kbd{DEL} key. It |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1187 deletes any amount of whitespace in the backwards direction if |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1188 hungry-delete mode is enabled. When it's disabled, or when used with |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1189 a prefix argument or in a literal (@pxref{Auto-newline Insertion}), |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1190 the function contained in the @code{c-backspace-function} variable is |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1191 called with the prefix argument. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1192 @end deffn |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1193 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1194 @defvar c-backspace-function |
25829 | 1195 @vindex backspace-function (c-) |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1196 @findex backward-delete-char-untabify |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1197 Hook that gets called by @code{c-electric-backspace} when it doesn't |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1198 do an ``electric'' deletion of the preceding whitespace. The default |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1199 value is @code{backward-delete-char-untabify}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1200 @end defvar |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1201 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1202 @deffn Command c-electric-delete-forward |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1203 @findex electric-delete-forward (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1204 This function, which is bound to @kbd{C-d} by default, works just like |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1205 @code{c-electric-backspace} but in the forward direction. When it |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1206 doesn't do an ``electric'' deletion of the following whitespace, it |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1207 calls the function in @code{c-delete-function} with its prefix |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1208 argument. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1209 @end deffn |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1210 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1211 @defvar c-delete-function |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1212 @vindex delete-function (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1213 @findex delete-char |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1214 Hook that gets called by @code{c-electric-delete-forward} when it |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1215 doesn't do an ``electric'' deletion of the following whitespace. The |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1216 default value is @code{delete-char}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1217 @end defvar |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1218 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1219 Above we have only talked about the @kbd{DEL} and @kbd{C-d} key events, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1220 without connecting them to the physical keys commonly known as |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1221 @key{Backspace} and @key{Delete}. The default behavior of those two |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1222 depends on the flavor of (X)Emacs you are using. |
25829 | 1223 |
1224 @findex c-electric-delete | |
1225 @findex electric-delete (c-) | |
1226 @vindex delete-key-deletes-forward | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1227 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1228 In XEmacs 20.3 and beyond, the @key{Backspace} key is bound to |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1229 @code{c-electric-backspace} and the @key{Delete} key is bound to |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1230 @code{c-electric-delete}. You control the direction it deletes in by |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1231 setting the variable @code{delete-key-deletes-forward}, a standard |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1232 XEmacs variable. When this variable is non-@code{nil}, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1233 @code{c-electric-delete} will do forward deletion with |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1234 @code{c-electric-delete-forward}, otherwise it does backward deletion |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1235 with @code{c-electric-backspace}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1236 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1237 In other Emacs versions, @ccmode{} doesn't bind either @key{Backspace} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1238 or @key{Delete}. In XEmacs 19 and Emacs prior to 21 that means that |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1239 it's up to you to fix them. Emacs 21 automatically binds them as |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1240 appropriate to @kbd{DEL} and @kbd{C-d}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1241 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1242 Another way to use hungry deletion is to bind |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1243 @code{c-hungry-backspace} and @code{c-hungry-delete-forward} directly |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1244 to keys, and not use the mode toggling. For example @kbd{C-c C-d} and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1245 @kbd{C-c DEL} to match plain @kbd{C-d} and @kbd{DEL}, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1246 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1247 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1248 (add-hook |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1249 'c-mode-common-hook |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1250 (lambda () |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1251 (define-key c-mode-base-map |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1252 [?\C-c ?\d] 'c-hungry-backspace) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1253 (define-key c-mode-base-map |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1254 [?\C-c ?\C-d] 'c-hungry-delete-forward))) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1255 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1256 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1257 @deffn Command c-hungry-backspace |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1258 @findex hungry-backspace (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1259 Delete any amount of whitespace in the backwards direction (regardless |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1260 whether hungry-delete mode is enabled or not). |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1261 @end deffn |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1262 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1263 @deffn Command c-hungry-delete-forward |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1264 @findex hungry-delete-forward (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1265 Delete any amount of whitespace in the forward direction (regardless |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1266 whether hungry-delete mode is enabled or not). |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1267 @end deffn |
25829 | 1268 |
1269 | |
1270 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1271 @node Text Filling and Line Breaking, Macro Handling, Minor Modes, Top |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1272 @comment node-name, next, previous, up |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1273 @chapter Text Filling and Line Breaking |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1274 @cindex text filling |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1275 @cindex line breaking |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1276 @cindex comment handling |
25829 | 1277 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
1278 | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1279 Since there's a lot of normal text in comments and string literals, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1280 @ccmode{} provides features to edit these like in text mode. The goal |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
1281 is to do it as seamlessly as possible, i.e., you can use auto fill mode, |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1282 sentence and paragraph movement, paragraph filling, adaptive filling etc |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1283 wherever there's a piece of normal text without having to think much |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1284 about it. @ccmode{} should keep the indentation, fix the comment line |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1285 decorations, and so on, for you. It does that by hooking in on the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1286 different line breaking functions and tuning relevant variables as |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1287 necessary. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1288 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1289 @vindex c-comment-prefix-regexp |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1290 @vindex comment-prefix-regexp (c-) |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1291 @cindex comment line prefix |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1292 @vindex comment-start |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1293 @vindex comment-end |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1294 @vindex comment-start-skip |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1295 @vindex paragraph-start |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1296 @vindex paragraph-separate |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1297 @vindex paragraph-ignore-fill-prefix |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1298 @vindex adaptive-fill-mode |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1299 @vindex adaptive-fill-regexp |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1300 @vindex adaptive-fill-first-line-regexp |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1301 To make Emacs recognize comments and treat text in them as normal |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1302 paragraphs, @ccmode{} makes several standard |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1303 variables@footnote{@code{comment-start}, @code{comment-end}, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1304 @code{comment-start-skip}, @code{paragraph-start}, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1305 @code{paragraph-separate}, @code{paragraph-ignore-fill-prefix}, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1306 @code{adaptive-fill-mode}, @code{adaptive-fill-regexp}, and |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1307 @code{adaptive-fill-first-line-regexp}.} buffer local and modifies them |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1308 according to the language syntax and the comment line prefix. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1309 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1310 @defopt c-comment-prefix-regexp |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1311 @vindex comment-prefix-regexp (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1312 This style variable contains the regexp used to recognize the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1313 @dfn{comment line prefix}, which is the line decoration that starts |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1314 every line in a comment. The default is @samp{//+\\|\\**}, which |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1315 matches C++ style line comments like |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1316 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1317 @example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1318 // blah blah |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1319 @end example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1320 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1321 @noindent |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1322 with two or more slashes in front of them, and C style block comments |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1323 like |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1324 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1325 @example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1326 @group |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1327 /* |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1328 * blah blah |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1329 */ |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1330 @end group |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1331 @end example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1332 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1333 @noindent |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1334 with zero or more stars at the beginning of every line. If you change |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1335 this variable, please make sure it still matches the comment starter |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
1336 (i.e., @code{//}) of line comments @emph{and} the line prefix inside |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1337 block comments. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1338 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1339 @findex c-setup-paragraph-variables |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1340 @findex setup-paragraph-variables (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1341 Also note that since @ccmode{} uses the value of |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1342 @code{c-comment-prefix-regexp} to set up several other variables at mode |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1343 initialization, there won't have any effect if you change it inside a |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1344 @ccmode{} buffer. You need to call the command |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1345 @code{c-setup-paragraph-variables} to update those other variables with |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1346 the new value. That's also the case if you modify this variable in a |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1347 mode hook, since @ccmode{} sets up all variables before calling them. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1348 @end defopt |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1349 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1350 @findex auto-fill-mode |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1351 @cindex Auto Fill mode |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1352 @cindex paragraph filling |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1353 Line breaks are by default handled (almost) the same regardless whether |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1354 they are made by auto fill mode (@pxref{Auto Fill,,, emacs, The Emacs |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
1355 Editor}), paragraph filling (e.g., with @kbd{M-q}), or explicitly with |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1356 @kbd{M-j} or similar methods. In string literals, the new line gets the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1357 same indentation as the previous nonempty line (may be changed with the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1358 @code{string} syntactic symbol). In comments, @ccmode{} uses |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1359 @code{c-comment-prefix-regexp} to adapt the line prefix from the other |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1360 lines in the comment. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1361 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1362 @vindex adaptive-fill-mode |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1363 @cindex Adaptive Fill mode |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1364 @ccmode{} uses adaptive fill mode (@pxref{Adaptive Fill,,, emacs, The |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1365 Emacs Editor}) to make Emacs correctly keep the line prefix when filling |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1366 paragraphs. That also makes Emacs preserve the text indentation |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
1367 @emph{inside} the comment line prefix. e.g., in the following comment, |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1368 both paragraphs will be filled with the left margins of the texts kept |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1369 intact: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1370 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1371 @example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1372 @group |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1373 /* Make a balanced b-tree of the nodes in the incoming |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1374 * stream. But, to quote the famous words of Donald E. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1375 * Knuth, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1376 * |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1377 * Beware of bugs in the above code; I have only |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1378 * proved it correct, not tried it. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1379 */ |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1380 @end group |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1381 @end example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1382 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1383 @findex c-setup-filladapt |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1384 @findex setup-filladapt (c-) |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1385 @findex filladapt-mode |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1386 @vindex filladapt-mode |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1387 @cindex Filladapt mode |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1388 It's also possible to use other adaptive filling packages, notably Kyle |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1389 E. Jones' Filladapt package@footnote{It's available from |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1390 @uref{http://www.wonderworks.com/}. As of version 2.12, it does however |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1391 lack a feature that makes it work suboptimally when |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1392 @code{c-comment-prefix-regexp} matches the empty string (which it does |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1393 by default). A patch for that is available from |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1394 @uref{http://cc-mode.sourceforge.net/,, the CC Mode web site}.}, |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1395 which handles things like bulleted lists nicely. There's a convenience |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1396 function @code{c-setup-filladapt} that tunes the relevant variables in |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
1397 Filladapt for use in @ccmode{}. Call it from a mode hook, e.g., with |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1398 something like this in your @file{.emacs}: |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1399 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1400 @example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1401 (defun my-c-mode-common-hook () |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1402 (c-setup-filladapt) |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1403 (filladapt-mode 1)) |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1404 (add-hook 'c-mode-common-hook 'my-c-mode-common-hook) |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1405 @end example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1406 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1407 @defopt c-block-comment-prefix |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1408 @vindex block-comment-prefix (c-) |
25829 | 1409 @vindex c-comment-continuation-stars |
1410 @vindex comment-continuation-stars (c-) | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1411 Normally the comment line prefix inserted for a new line inside a |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1412 comment is deduced from other lines in it. However there's one |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1413 situation when there's no hint about what the prefix should look like, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1414 namely when a block comment is broken for the first time. This style |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1415 variable@footnote{In versions before 5.26, this variable was called |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1416 @code{c-comment-continuation-stars}. As a compatibility measure, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1417 @ccmode{} still uses the value on that variable if it's set.} is used |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1418 then as the comment prefix. It defaults to @samp{* }, which makes a |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1419 comment |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1420 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1421 @example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1422 /* Got O(n^2) here, which is a Bad Thing. */ |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1423 @end example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1424 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1425 @noindent |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1426 break into |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1427 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1428 @example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1429 @group |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1430 /* Got O(n^2) here, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1431 * which is a Bad Thing. */ |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1432 @end group |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1433 @end example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1434 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1435 Note that it won't work to adjust the indentation by putting leading |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1436 spaces in @code{c-block-comment-prefix}, since @ccmode{} still uses the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1437 normal indentation engine to indent the line. Thus, the right way to |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1438 fix the indentation is by customizing the @code{c} syntactic symbol. It |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1439 defaults to @code{c-lineup-C-comments}, which handles the indentation of |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1440 most common comment styles, see @ref{Indentation Functions}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1441 @end defopt |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1442 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1443 @defopt c-ignore-auto-fill |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1444 @vindex ignore-auto-fill (c-) |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1445 When auto fill mode is enabled, @ccmode{} can selectively ignore it |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
1446 depending on the context the line break would occur in, e.g., to never |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1447 break a line automatically inside a string literal. This variable |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1448 takes a list of symbols for the different contexts where auto-filling |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1449 never should occur: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1450 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1451 @table @code |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1452 @item string |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1453 Inside a string or character literal. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1454 @item c |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1455 Inside a C style block comment. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1456 @item c++ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1457 Inside a C++ style line comment. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1458 @item cpp |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1459 Inside a preprocessor directive. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1460 @item code |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
1461 Anywhere else, i.e., in normal code. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1462 @end table |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1463 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1464 By default, @code{c-ignore-auto-fill} is set to @code{'(string cpp |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1465 code)}, which means that auto-filling only occurs in comments when |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1466 auto-fill mode is activated. In literals, it's often desirable to have |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1467 explicit control over newlines. In preprocessor directives, the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1468 necessary @samp{\} escape character before the newline is not |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1469 automatically inserted, so an automatic line break would produce invalid |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1470 code. In normal code, line breaks are normally dictated by some logical |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1471 structure in the code rather than the last whitespace character, so |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1472 automatic line breaks there will produce poor results in the current |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1473 implementation. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1474 @end defopt |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1475 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1476 The commands that do the actual work follow. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1477 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1478 @table @asis |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1479 @item @kbd{M-q} (@code{c-fill-paragraph}) |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1480 @kindex M-q |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1481 @findex c-fill-paragraph |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1482 @findex fill-paragraph (c-) |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1483 @cindex Javadoc markup |
36923 | 1484 @cindex Pike autodoc markup |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1485 This is the replacement for @code{fill-paragraph} in @ccmode{} |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1486 buffers. It's used to fill multiline string literals and both block and |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1487 line style comments. In Java buffers, the Javadoc markup words are |
36923 | 1488 recognized as paragraph starters. The line oriented Pike autodoc markup |
1489 words are recognized in the same way in Pike mode. | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1490 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1491 The function keeps the comment starters and enders of block comments as |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1492 they were before the filling. This means that a comment ender on the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1493 same line as the paragraph being filled will be filled with the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1494 paragraph, and one on a line by itself will stay as it is. The comment |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1495 starter is handled similarly@footnote{This means that the variables |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1496 @code{c-hanging-comment-starter-p} and @code{c-hanging-comment-ender-p}, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1497 which controlled this behavior in earlier versions of @ccmode{}, are now |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1498 obsolete.}. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1499 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1500 @item @kbd{M-j} (@code{c-indent-new-comment-line}) |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1501 @kindex M-j |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1502 @findex c-indent-new-comment-line |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1503 @findex indent-new-comment-line (c-) |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1504 This is the replacement for @code{indent-new-comment-line}. It breaks |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1505 the line at point and indents the new line like the current one. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1506 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1507 @vindex comment-multi-line |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1508 If inside a comment and @code{comment-multi-line} is non-@code{nil}, the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1509 indentation and line prefix are preserved. If inside a comment and |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1510 @code{comment-multi-line} is @code{nil}, a new comment of the same type |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1511 is started on the next line and indented as appropriate for comments. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1512 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1513 Note that @ccmode{} sets @code{comment-multi-line} to @code{t} at |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1514 startup. The reason is that @kbd{M-j} could otherwise produce sequences |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1515 of single line block comments for texts that should logically be treated |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1516 as one comment, and the rest of the paragraph handling code |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
1517 (e.g., @kbd{M-q} and @kbd{M-a}) can't cope with that, which would lead to |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1518 inconsistent behavior. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1519 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1520 @item @kbd{M-x c-context-line-break} |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1521 @findex c-context-line-break |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1522 @findex context-line-break (c-) |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1523 This is a function that works like @code{indent-new-comment-line} in |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1524 comments and @code{newline-and-indent} elsewhere, thus combining those |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1525 two in a way that uses each one in the context it's best suited for. |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
1526 I.e., in comments the comment line prefix and indentation is kept for |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1527 the new line, and in normal code it's indented according to context by |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1528 the indentation engine. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1529 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1530 In macros it acts like @code{newline-and-indent} but additionally |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1531 inserts and optionally aligns the line ending backslash so that the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1532 macro remains unbroken. @xref{Macro Handling}, for details about the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1533 backslash alignment. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1534 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1535 It's not bound to a key by default, but it's intended to be used on the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1536 @kbd{RET} key. If you like the behavior of @code{newline-and-indent} on |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1537 @kbd{RET}, you should consider switching to this function. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1538 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1539 @item @kbd{M-x c-context-open-line} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1540 @findex c-context-open-line |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1541 @findex context-open-line (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1542 This is to @kbd{C-o} (@kbd{M-x open-line}) as |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
1543 @code{c-context-line-break} is to @kbd{RET}. I.e., it works just like |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1544 @code{c-context-line-break} but leaves the point before the inserted |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1545 line break. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1546 @end table |
25829 | 1547 |
1548 | |
1549 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1550 @node Macro Handling, Font Locking, Text Filling and Line Breaking, Top |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1551 @comment node-name, next, previous, up |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1552 @chapter Macro Handling |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1553 @cindex macros |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1554 @cindex preprocessor directives |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1555 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1556 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1557 Preprocessor directives are handled as syntactic whitespace from other |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
1558 code, i.e., they can be interspersed anywhere without affecting the |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1559 syntactic analysis, just like comments. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1560 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1561 The code inside macro definitions is still analyzed syntactically so |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1562 that you get relative indentation there just as you'd get if the same |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1563 code was outside a macro. However, since there is no hint about the |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
1564 syntactic context, i.e., whether the macro expands to an expression, to some |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1565 statements, or perhaps to whole functions, the syntactic recognition can be |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1566 wrong. @ccmode{} manages to figure it out correctly most of the time, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1567 though. @xref{Syntactic Symbols}, for details about the indentation. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1568 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1569 @defopt c-syntactic-indentation-in-macros |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1570 @vindex syntactic-indentation-in-macros (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1571 Enable syntactic analysis inside macros, which is the default. If this |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1572 is @code{nil}, all lines inside macro definitions are analyzed as |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1573 @code{cpp-macro-cont}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1574 @end defopt |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1575 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1576 @ccmode{} provides some tools to help keep the line continuation |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1577 backslashes in macros neat and tidy: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1578 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1579 @table @asis |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1580 @item @kbd{C-c C-\} (@code{c-backslash-region}) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1581 @kindex C-c C-\ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1582 @findex c-backslash-region |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1583 @findex backslash-region (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1584 This function inserts and aligns or deletes the end-of-line backslashes |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1585 in the current region. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1586 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1587 With no prefix argument, it inserts any missing backslashes and aligns |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1588 them according to the @code{c-backslash-column} and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1589 @code{c-backslash-max-column} variables. With a prefix argument, it |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1590 deletes any backslashes. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1591 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1592 The function does not modify blank lines at the start of the region. If |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1593 the region ends at the start of a line, it always deletes the backslash |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1594 (if any) at the end of the previous line. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1595 @end table |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1596 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1597 @defopt c-backslash-column |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1598 @vindex backslash-column (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1599 @defoptx c-backslash-max-column |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1600 @vindex backslash-max-column (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1601 These variables control the alignment columns for line continuation |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1602 backslashes in multiline macros. They are used by the functions that |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1603 automatically insert or align such backslashes, |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
1604 e.g., @code{c-backslash-region} and @code{c-context-line-break}. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1605 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1606 @code{c-backslash-column} specifies the minimum column for the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1607 backslashes. If any line in the macro exceeds it then the next tab |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1608 stop from that line is used as the alignment column for all the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1609 backslashes, so that they remain in a single column. However, if some |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1610 lines exceed @code{c-backslash-max-column} then the backslashes in the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1611 rest of the macro will be kept at that column, so that the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1612 lines which are too long ``stick out'' instead. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1613 @end defopt |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1614 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1615 @defopt c-auto-align-backslashes |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1616 @vindex auto-align-backslashes (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1617 Align automatically inserted line continuation backslashes if |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1618 non-@code{nil}. When line continuation backslashes are inserted |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
1619 automatically for line breaks in multiline macros, e.g., by |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1620 @code{c-context-line-break}, they are aligned with the other backslashes |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1621 in the same macro if this flag is set. Otherwise the inserted |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1622 backslashes are preceded by a single space. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1623 @end defopt |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1624 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1625 The recommended line breaking function, @code{c-context-line-break} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1626 (@pxref{Text Filling and Line Breaking}), is especially nice if you edit |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1627 multiline macros frequently. When used inside a macro, it automatically |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1628 inserts and adjusts the mandatory backslash at the end of the line to |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1629 keep the macro together, and it leaves the point at the right |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1630 indentation column for the code. Thus you can write code inside macros |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1631 almost exactly as you can elsewhere, without having to bother with the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1632 trailing backslashes. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1633 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1634 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1635 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1636 @node Font Locking, Commands, Macro Handling, Top |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1637 @comment node-name, next, previous, up |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1638 @chapter Font Locking |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1639 @cindex font locking |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1640 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1641 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1642 @strong{Note:} The font locking in AWK mode is currently not integrated |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1643 with the rest of @ccmode{}, so this section does not apply there. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1644 @xref{AWK Mode Font Locking}, instead. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1645 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1646 @cindex Font Lock mode |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1647 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1648 @ccmode{} provides font locking for its supported languages by supplying |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1649 patterns for use with Font Lock mode. This means that you get distinct |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1650 faces on the various syntactic parts such as comments, strings, keywords |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1651 and types, which is very helpful in telling them apart at a glance and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1652 discovering syntactic errors. @xref{Font Lock,,, emacs, The Emacs |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1653 Editor}, for ways to enable font locking in @ccmode{} buffers. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1654 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1655 @menu |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1656 * Font Locking Preliminaries:: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1657 * Faces:: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1658 * Documentation Comments:: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1659 @end menu |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1660 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1661 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1662 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1663 @node Font Locking Preliminaries, Faces, , Font Locking |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1664 @comment node-name, next, previous, up |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1665 @section Font Locking Preliminaries |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1666 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1667 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1668 The font locking for most of the @ccmode{} languages were provided |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1669 directly by the Font Lock package prior to version 5.30 of @ccmode{}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1670 In the transition to @ccmode{} the patterns have been reworked |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1671 completely and are applied uniformly across all the languages except AWK |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1672 mode, just like the indentation rules (although each language still has |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1673 some pecularities of its own, of course). Since the languages |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1674 previously had completely separate font locking patterns, this means |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1675 that it's a bit different in most languages now. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1676 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1677 The main goal for the font locking in @ccmode{} is accuracy, to provide |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1678 a dependable aid in recognizing the various constructs. Some, like |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1679 strings and comments, are easy to recognize while others like |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1680 declarations and types can be very tricky. @ccmode{} can go to great |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1681 lengths to recognize declarations and casts correctly, especially when |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1682 the types aren't recognized by standard patterns. This is a fairly |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1683 demanding analysis which can be slow on older hardware, and it can |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1684 therefore be disabled by choosing a lower decoration level with the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1685 variable @code{font-lock-maximum-decoration}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1686 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1687 @vindex font-lock-maximum-decoration |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1688 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1689 The decoration levels are used as follows: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1690 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1691 @enumerate |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1692 @comment 1 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1693 @item |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1694 Minimal font locking: Fontify only comments, strings and preprocessor |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1695 directives (in the languages that use cpp). |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1696 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1697 @comment 2 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1698 @item |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1699 Fast normal font locking: In addition to level 1, fontify keywords, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1700 simple types and declarations that are easy to recognize. The variables |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1701 @code{*-font-lock-extra-types} (where @samp{*} is the name of the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1702 language) are used to recognize types (see below). Documentation |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1703 comments like Javadoc are fontified according to |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1704 @code{c-doc-comment-style} (@pxref{Documentation Comments}). |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1705 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1706 Use this if you think the font locking is too slow. It's the closest |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1707 corresponding level to level 3 in the old font lock patterns. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1708 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1709 @comment 3 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1710 @item |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1711 Accurate normal font locking: Like level 2 but uses a different approach |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1712 that can recognize types and declarations much more accurately. The |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1713 @code{*-font-lock-extra-types} variables are still used, but user |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1714 defined types are recognized correctly anyway in most cases. Therefore |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1715 those variables should be fairly restrictive and not contain patterns |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1716 that are uncertain. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1717 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1718 @cindex Lazy Lock mode |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1719 @cindex Just-in-time Lock mode |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1720 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1721 This level is designed for fairly modern hardware and a font lock |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1722 support mode like Lazy Lock or Just-in-time Lock mode that only |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1723 fontifies the parts that are actually shown. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1724 @end enumerate |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1725 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1726 @cindex user defined types |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1727 @cindex types, user defined |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1728 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1729 Since user defined types are hard to recognize you can provide |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1730 additional regexps to match those you use: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1731 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1732 @defopt c-font-lock-extra-types |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1733 @defoptx c++-font-lock-extra-types |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1734 @defoptx objc-font-lock-extra-types |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1735 @defoptx java-font-lock-extra-types |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1736 @defoptx idl-font-lock-extra-types |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1737 @defoptx pike-font-lock-extra-types |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1738 For each language there's a variable @code{*-font-lock-extra-types}, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1739 where @samp{*} stands for the language in question. It contains a list |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1740 of regexps that matches identifiers that should be recognized as types, |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
1741 e.g., @samp{\\sw+_t} to recognize all identifiers ending with @samp{_t} |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1742 as is customary in C code. Each regexp should not match more than a |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1743 single identifier. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1744 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1745 The default values contain regexps for many types in standard runtime |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1746 libraries that are otherwise difficult to recognize, and patterns for |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1747 standard type naming conventions like the @samp{_t} suffix in C and C++. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1748 Java, Objective-C and Pike have as a convention to start class names |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1749 with capitals, so there are patterns for that in those languages. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1750 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1751 Despite the names of these variables, they are not only used for |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1752 fontification but in other places as well where @ccmode{} needs to |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1753 recognize types. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1754 @end defopt |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1755 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1756 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1757 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1758 @node Faces, Documentation Comments, Font Locking Preliminaries, Font Locking |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1759 @comment node-name, next, previous, up |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1760 @section Faces |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1761 @cindex faces |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1762 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1763 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1764 @ccmode{} attempts to use the standard faces for programming languages |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1765 in accordance with their intended purposes as far as possible. No extra |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1766 faces are currently provided, with the exception of a replacement face |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1767 @code{c-invalid-face} for emacsen that don't provide |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1768 @code{font-lock-warning-face}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1769 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1770 @itemize @bullet |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1771 @item |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1772 @vindex font-lock-comment-face |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1773 Normal comments are fontified in @code{font-lock-comment-face}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1774 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1775 @item |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1776 @vindex font-lock-doc-face |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1777 @vindex font-lock-doc-string-face |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1778 @vindex font-lock-comment-face |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1779 Comments that are recognized as documentation (@pxref{Documentation |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1780 Comments}) get @code{font-lock-doc-face} (Emacs) or |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1781 @code{font-lock-doc-string-face} (XEmacs) if those faces exist. If they |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1782 don't then @code{font-lock-comment-face} is used. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1783 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1784 @item |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1785 @vindex font-lock-string-face |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1786 String and character literals are fontified in |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1787 @code{font-lock-string-face}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1788 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1789 @item |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1790 @vindex font-lock-keyword-face |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1791 Keywords are fontified with @code{font-lock-keyword-face}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1792 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1793 @item |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1794 @vindex font-lock-function-name-face |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1795 @code{font-lock-function-name-face} is used for function names in |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1796 declarations and definitions, and classes in those contexts. It's also |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1797 used for preprocessor defines with arguments. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1798 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1799 @item |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1800 @vindex font-lock-variable-name-face |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1801 Variables in declarations and definitions, and other identifiers in such |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1802 variable contexts, get @code{font-lock-variable-name-face}. It's also |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1803 used for preprocessor defines without arguments. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1804 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1805 @item |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1806 @vindex font-lock-constant-face |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1807 @vindex font-lock-reference-face |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1808 Builtin constants are fontified in @code{font-lock-constant-face} if it |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1809 exists, @code{font-lock-reference-face} otherwise. As opposed to the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1810 preceding two faces, this is used on the names in expressions, and it's |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1811 not used in declarations, even if there happen to be a @samp{const} in |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1812 them somewhere. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1813 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1814 @item |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1815 @vindex font-lock-type-face |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1816 @code{font-lock-type-face} is put on types (both predefined and user |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1817 defined) and classes in type contexts. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1818 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1819 @item |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1820 @vindex font-lock-constant-face |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1821 @vindex font-lock-reference-face |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1822 Label identifiers get @code{font-lock-constant-face} if it exists, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1823 @code{font-lock-reference-face} otherwise. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1824 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1825 @item |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1826 Name qualifiers and identifiers for scope constructs are fontified like |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1827 labels. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1828 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1829 @item |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1830 Special markup inside documentation comments are also fontified like |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1831 labels. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1832 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1833 @item |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1834 @vindex font-lock-preprocessor-face |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1835 @vindex font-lock-builtin-face |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1836 @vindex font-lock-reference-face |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1837 Preprocessor directives get @code{font-lock-preprocessor-face} if it |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
1838 exists (i.e., XEmacs). In Emacs they get @code{font-lock-builtin-face} |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1839 or @code{font-lock-reference-face}, for lack of a closer equivalent. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1840 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1841 @item |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1842 @vindex font-lock-warning-face |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1843 @vindex c-invalid-face |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1844 @vindex invalid-face (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1845 Some kinds of syntactic errors are fontified with |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1846 @code{font-lock-warning-face} in Emacs. In older XEmacs versions |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1847 there's no corresponding standard face, so there a special |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1848 @code{c-invalid-face} is used, which is defined to stand out sharply by |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1849 default. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1850 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1851 Note that it's not used for @samp{#error} or @samp{#warning} directives, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1852 since those aren't syntactic errors in themselves. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1853 @end itemize |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1854 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1855 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1856 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1857 @node Documentation Comments, , Faces, Font Locking |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1858 @comment node-name, next, previous, up |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1859 @section Documentation Comments |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1860 @cindex documentation comments |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1861 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1862 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1863 There are various tools to supply documentation in the source as |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
1864 specially structured comments, e.g., the standard Javadoc tool in Java. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1865 @ccmode{} provides an extensible mechanism to fontify such comments and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1866 the special markup inside them. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1867 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1868 @defopt c-doc-comment-style |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1869 @vindex doc-comment-style (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1870 This is a style variable that specifies which documentation comment |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
1871 style to recognize, e.g., @code{javadoc} for Javadoc comments. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1872 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1873 The value may also be a list of styles, in which case all of them are |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1874 recognized simultaneously (presumably with markup cues that don't |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1875 conflict). |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1876 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1877 The value may also be an association list to specify different comment |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1878 styles for different languages. The symbol for the major mode is then |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1879 looked up in the alist, and the value of that element is interpreted as |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1880 above if found. If it isn't found then the symbol `other' is looked up |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1881 and its value is used instead. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1882 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1883 Note that @ccmode{} uses this variable to set other variables that |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1884 handle fontification etc. That's done at mode initialization or when |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1885 you switch to a style which sets this variable. Thus, if you change it |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
1886 in some other way, e.g., interactively in a CC Mode buffer, you will need |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1887 to do @kbd{M-x java-mode} (or whatever mode you're currently using) to |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1888 reinitialize. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1889 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1890 @findex c-setup-doc-comment-style |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1891 @findex setup-doc-comment-style (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1892 Note also that when @ccmode{} starts up, the other variables are |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1893 modified before the mode hooks are run. If you change this variable in |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1894 a mode hook, you have to call @code{c-setup-doc-comment-style} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1895 afterwards to redo that work. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1896 @end defopt |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1897 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1898 @ccmode{} currently provides handing of the following doc comment |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1899 styles: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1900 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1901 @table @code |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1902 @item javadoc |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1903 @cindex Javadoc markup |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1904 Javadoc comments, the standard tool in Java. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1905 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1906 @item autodoc |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1907 @cindex Pike autodoc markup |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1908 For Pike autodoc markup, the standard in Pike. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1909 @end table |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1910 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1911 The above is by no means complete. If you'd like to see support for |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1912 other doc comment styles, please let us know (@pxref{Mailing Lists and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1913 Submitting Bug Reports}). |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1914 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1915 You can also write your own doc comment fontification support to use |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1916 with @code{c-doc-comment-style}: Supply a variable or function |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1917 @code{*-font-lock-keywords} where @samp{*} is the name you want to use |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1918 in @code{c-doc-comment-style}. If it's a variable, it's prepended to |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1919 @code{font-lock-keywords}. If it's a function, it's called at mode |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1920 initialization and the result is prepended. For an example, see |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1921 @code{javadoc-font-lock-keywords} in @file{cc-fonts.el}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1922 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1923 If you add support for another doc comment style, please consider |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1924 contributing it --- send a note to @email{bug-cc-mode@@gnu.org}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1925 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1926 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1927 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1928 @node Commands, Customizing Indentation, Font Locking, Top |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1929 @comment node-name, next, previous, up |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1930 @chapter Commands |
25829 | 1931 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
1932 | |
1933 @menu | |
1934 * Indentation Commands:: | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1935 * Movement Commands:: |
25829 | 1936 * Other Commands:: |
1937 @end menu | |
1938 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1939 See also @ref{Text Filling and Line Breaking} and @ref{Macro Handling}, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1940 for commands concerning those bits. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1941 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1942 |
25829 | 1943 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1944 @node Indentation Commands, Movement Commands, , Commands |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1945 @comment node-name, next, previous,up |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1946 @section Indentation Commands |
25829 | 1947 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
1948 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1949 The following list of commands reindent C constructs. Note that when |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1950 you change your coding style, either interactively or through some other |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1951 means, your file does @emph{not} automatically get reindented. You |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1952 will need to execute one of the following commands to see the effects of |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1953 your changes. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1954 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1955 @cindex GNU indent program |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1956 Also, variables like @code{c-hanging-*} and @code{c-cleanup-list} |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1957 only affect how on-the-fly code is formatted. Changing the |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1958 ``hanginess'' of a brace and then reindenting, will not move the brace |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1959 to a different line. For this, you're better off getting an external |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1960 program like GNU @code{indent}, which will rearrange brace location, |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1961 among other things. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1962 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1963 Reindenting large sections of code can take a long time. When |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1964 @ccmode{} reindents a region of code, it is essentially equivalent to |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1965 hitting @kbd{TAB} on every line of the region. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1966 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1967 These commands are useful when indenting code: |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1968 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1969 @table @asis |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1970 @item @kbd{TAB} (@code{c-indent-command}) |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1971 @kindex TAB |
25829 | 1972 @findex c-indent-command |
1973 @findex indent-command (c-) | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1974 Indents the current line. The actual behavior is controlled by several |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1975 variables, described below. See @code{c-tab-always-indent}, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1976 @code{c-insert-tab-function}, and @code{indent-tabs-mode}. With a |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1977 numeric argument, this command rigidly indents the region, preserving |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1978 the relative indentation among the lines. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1979 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1980 @item @kbd{C-M-q} (@code{c-indent-exp}) |
40705 | 1981 @kindex C-M-q |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1982 @findex c-indent-exp |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1983 @findex indent-exp (c-) |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1984 Indent an entire balanced brace or parenthesis expression. Note that |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1985 point must be on the opening brace or parenthesis of the expression you |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1986 want to indent. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1987 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1988 @item @kbd{C-c C-q} (@code{c-indent-defun}) |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1989 @kindex C-c C-q |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1990 @findex c-indent-defun |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
1991 @findex indent-defun (c-) |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1992 Indents the entire top-level function, class or macro definition |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1993 encompassing point. It leaves point unchanged. This function can't be |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1994 used to reindent a nested brace construct, such as a nested class or |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1995 function, or a Java method. The top-level construct being reindented |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
1996 must be complete, i.e., it must have both a beginning brace and an ending |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1997 brace. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1998 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
1999 @item @kbd{C-M-\} (@code{indent-region}) |
40705 | 2000 @kindex C-M-\ |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2001 @findex indent-region |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2002 Indents an arbitrary region of code. This is a standard Emacs command, |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2003 tailored for C code in a @ccmode{} buffer. Note, of course, that point |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2004 and mark must delineate the region you want to indent. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2005 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2006 @item @kbd{M-;} (@code{indent-for-comment}) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2007 @kindex M-; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2008 @findex indent-for-comment |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2009 Insert a comment at the end of the current line, if none is there already. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2010 Then reindent the comment according to the variables |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2011 @code{c-indent-comment-alist}, @code{c-indent-comments-syntactically-p} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2012 and @code{comment-column}. Then position the point after the comment |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2013 starter. This is a standard Emacs command, but @ccmode{} enhances it a |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2014 bit with two variables: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2015 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2016 @defopt c-indent-comment-alist |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2017 @vindex indent-comment-alist (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2018 @vindex comment-column |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2019 This style variable allows you to control which column @kbd{M-;} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2020 indents the comment to, depending on the preceding code and the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2021 indentation of a similar comment on the preceding line, if there is |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2022 any. It is an association list that maps different types of lines to |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2023 actions describing how they should be handled. If a certain line type |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2024 isn't present on the list then the line is indented to the column |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2025 specified by @code{comment-column}. See the documentation string for |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2026 @code{c-indent-comment-alist} for a full description of the available |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2027 line types and actions (use @kbd{C-h v c-indent-comment-alist}). |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2028 @end defopt |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2029 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2030 @defopt c-indent-comments-syntactically-p |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2031 @vindex indent-comments-syntactically-p (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2032 Normally, when this variable is @code{nil}, @kbd{M-;} will indent |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2033 comment-only lines according to @code{c-indent-comment-alist}, just as |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2034 it does with lines where other code precede the comments. However, if |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2035 you want it to act just like @kbd{TAB} for comment-only lines you can |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2036 get that by setting @code{c-indent-comments-syntactically-p} to |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2037 non-@code{nil}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2038 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2039 If @code{c-indent-comments-syntactically-p} is non-@code{nil} then |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2040 @code{c-indent-comment-alist} won't be consulted at all for comment-only |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2041 lines. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2042 @end defopt |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2043 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2044 @item @kbd{C-M-h} (@code{c-mark-function}) |
40705 | 2045 @kindex C-M-h |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2046 @findex c-mark-function |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2047 @findex mark-function (c-) |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2048 While not strictly an indentation command, this is useful for marking |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2049 the current top-level function or class definition as the current |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2050 region. As with @code{c-indent-defun}, this command operates on |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2051 top-level constructs, and can't be used to mark say, a Java method. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2052 @end table |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2053 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2054 These variables are also useful when indenting code: |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2055 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2056 @defopt c-tab-always-indent |
25829 | 2057 @vindex tab-always-indent (c-) |
2058 @kindex TAB | |
2059 @cindex literal | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2060 This variable controls how @kbd{TAB} (@code{c-indent-command}) operates. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2061 When it is @code{t}, @kbd{TAB} always indents the current line. When it |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2062 is @code{nil}, the line is indented only if point is at the left margin, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2063 or on or before the first non-whitespace character on the line, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2064 otherwise some whitespace is inserted. If this variable is the symbol |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2065 @code{other}, then some whitespace is inserted only within strings and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2066 comments (literals), and inside preprocessor directives, but the line is |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2067 always reindented. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2068 @end defopt |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2069 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2070 @defopt c-insert-tab-function |
25829 | 2071 @vindex insert-tab-function (c-) |
2072 @findex tab-to-tab-stop | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2073 When ``some whitespace'' is inserted as described above, what actually |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2074 happens is that the function stored in @code{c-insert-tab-function} is |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2075 called. Normally, this just inserts a real tab character, or the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2076 equivalent number of spaces, depending on @code{indent-tabs-mode}. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2077 Some people, however, set @code{c-insert-tab-function} to |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2078 @code{tab-to-tab-stop} so as to get hard tab stops when indenting. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2079 @end defopt |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2080 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2081 @defopt indent-tabs-mode |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2082 This is a standard Emacs variable that controls how line indentation |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2083 is composed. When it's non-@code{nil}, tabs can be used in a line's |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2084 indentation, otherwise only spaces can be used. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2085 @end defopt |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2086 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2087 @defopt c-progress-interval |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2088 @vindex progress-interval (c-) |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47737
diff
changeset
|
2089 When indenting large regions of code, this variable controls how often a |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2090 progress message is displayed. Set this variable to @code{nil} to |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2091 inhibit the progress messages, or set it to an integer which is how |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2092 often (in seconds) progress messages are to be displayed. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2093 @end defopt |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2094 |
25829 | 2095 |
2096 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2097 @node Movement Commands, Other Commands, Indentation Commands, Commands |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2098 @comment node-name, next, previous, up |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2099 @section Movement Commands |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2100 @cindex movement |
25829 | 2101 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
2102 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2103 @ccmode{} contains some useful commands for moving around in C |
25829 | 2104 code. |
2105 | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2106 @table @asis |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2107 @item @kbd{M-x c-beginning-of-defun} |
25829 | 2108 @findex c-beginning-of-defun |
2109 @findex beginning-of-defun (c-) | |
2110 @findex beginning-of-defun | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2111 Move point back to the least-enclosing brace. This function is |
25829 | 2112 analogous to the Emacs built-in command @code{beginning-of-defun}, |
2113 except it eliminates the constraint that the top-level opening brace | |
2114 must be in column zero. See @code{beginning-of-defun} for more | |
2115 information. | |
2116 | |
2117 Depending on the coding style being used, you might prefer | |
2118 @code{c-beginning-of-defun} to @code{beginning-of-defun}. If so, | |
2119 consider binding @kbd{C-M-a} to the former instead. For backwards | |
2120 compatibility reasons, the default binding remains in effect. | |
2121 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2122 In AWK mode, a defun doesn't necessarily have braces at all. AWK Mode |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2123 therefore has its own version of this function which is bound by |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2124 default to @kbd{C-M-a}. You can thus chose freely which function to |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2125 bind to @kbd{C-M-a} for the other modes without worrying about AWK |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2126 buffers. @xref{AWK Mode Defuns}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2127 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2128 @item @kbd{M-x c-end-of-defun} |
25829 | 2129 @findex c-end-of-defun |
2130 @findex end-of-defun (c-) | |
2131 @findex end-of-defun | |
2132 Moves point to the end of the current top-level definition. This | |
2133 function is analogous to the Emacs built-in command @code{end-of-defun}, | |
2134 except it eliminates the constraint that the top-level opening brace of | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2135 the defun must be in column zero. See @code{end-of-defun} for more |
25829 | 2136 information. |
2137 | |
2138 Depending on the coding style being used, you might prefer | |
2139 @code{c-end-of-defun} to @code{end-of-defun}. If so, | |
2140 consider binding @kbd{C-M-e} to the former instead. For backwards | |
2141 compatibility reasons, the default binding remains in effect. | |
2142 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2143 In AWK Mode, a defun doesn't necessarily have braces at all. AWK Mode |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2144 therefore has its own version of this function which is bound by |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2145 default to @kbd{C-M-e}. You can thus chose freely which function to |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2146 bind to @kbd{C-M-e} for the other modes without worrying about AWK |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2147 buffers. @ref{AWK Mode Defuns}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2148 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2149 @item @kbd{C-c C-u} (@code{c-up-conditional}) |
25829 | 2150 @kindex C-c C-u |
2151 @findex c-up-conditional | |
2152 @findex up-conditional (c-) | |
2153 Move point back to the containing preprocessor conditional, leaving the | |
2154 mark behind. A prefix argument acts as a repeat count. With a negative | |
2155 argument, move point forward to the end of the containing | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2156 preprocessor conditional. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2157 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2158 @samp{#elif} is treated like @samp{#else} followed by @samp{#if}, so the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2159 function stops at them when going backward, but not when going forward. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2160 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2161 @item @kbd{M-x c-up-conditional-with-else} |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2162 @findex c-up-conditional-with-else |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2163 @findex up-conditional-with-else (c-) |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2164 A variety of @code{c-up-conditional} that also stops at @samp{#else} |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2165 lines. Normally those lines are ignored. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2166 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2167 @item @kbd{M-x c-down-conditional} |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2168 @findex c-down-conditional |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2169 @findex down-conditional (c-) |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2170 Move point forward into the next nested preprocessor conditional, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2171 leaving the mark behind. A prefix argument acts as a repeat count. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2172 With a negative argument, move point backward into the previous |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2173 nested preprocessor conditional. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2174 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2175 @samp{#elif} is treated like @samp{#else} followed by @samp{#if}, so the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2176 function stops at them when going forward, but not when going backward. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2177 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2178 @item @kbd{M-x c-down-conditional-with-else} |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2179 @findex c-down-conditional-with-else |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2180 @findex down-conditional-with-else (c-) |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2181 A variety of @code{c-down-conditional} that also stops at @samp{#else} |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2182 lines. Normally those lines are ignored. |
25829 | 2183 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2184 @item @kbd{C-c C-p} (@code{c-backward-conditional}) |
25829 | 2185 @kindex C-c C-p |
2186 @findex c-backward-conditional | |
2187 @findex backward-conditional (c-) | |
2188 Move point back over a preprocessor conditional, leaving the mark | |
2189 behind. A prefix argument acts as a repeat count. With a negative | |
2190 argument, move forward. | |
2191 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2192 @item @kbd{C-c C-n} (@code{c-forward-conditional}) |
25829 | 2193 @kindex C-c C-n |
2194 @findex c-forward-conditional | |
2195 @findex forward-conditional (c-) | |
2196 Move point forward across a preprocessor conditional, leaving the mark | |
2197 behind. A prefix argument acts as a repeat count. With a negative | |
2198 argument, move backward. | |
2199 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2200 @item @kbd{M-a} (@code{c-beginning-of-statement}) |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2201 @kindex M-a |
25829 | 2202 @findex c-beginning-of-statement |
2203 @findex beginning-of-statement (c-) | |
2204 Move point to the beginning of the innermost C statement. If point is | |
36923 | 2205 already at the beginning of a statement, move to the beginning of the |
2206 closest preceding statement, even if that means moving into a block (you | |
40705 | 2207 can use @kbd{C-M-b} to move over a balanced block). With prefix |
25829 | 2208 argument @var{n}, move back @var{n} @minus{} 1 statements. |
2209 | |
36923 | 2210 If point is within or next to a comment or a string which spans more |
2211 than one line, this command moves by sentences instead of statements. | |
25829 | 2212 |
2213 When called from a program, this function takes three optional | |
36923 | 2214 arguments: the repetition count, a buffer position limit which is the |
2215 farthest back to search for the syntactic context, and a flag saying | |
2216 whether to do sentence motion in or near comments and multiline strings. | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2217 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2218 @item @kbd{M-e} (@code{c-end-of-statement}) |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2219 @kindex M-e |
25829 | 2220 @findex c-end-of-statement |
2221 @findex end-of-statement (c-) | |
2222 Move point to the end of the innermost C statement. If point is at the | |
2223 end of a statement, move to the end of the next statement, even if it's | |
40705 | 2224 inside a nested block (use @kbd{C-M-f} to move to the other side of the |
25829 | 2225 block). With prefix argument @var{n}, move forward @var{n} @minus{} 1 |
2226 statements. | |
2227 | |
36923 | 2228 If point is within or next to a comment or a string which spans more |
2229 than one line, this command moves by sentences instead of statements. | |
25829 | 2230 |
2231 When called from a program, this function takes three optional | |
36923 | 2232 arguments: the repetition count, a buffer position limit which is the |
2233 farthest back to search for the syntactic context, and a flag saying | |
2234 whether to do sentence motion in or near comments and multiline strings. | |
25829 | 2235 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2236 @item @kbd{M-x c-forward-into-nomenclature} |
25829 | 2237 @findex c-forward-into-nomenclature |
2238 @findex forward-into-nomenclature (c-) | |
2239 A popular programming style, especially for object-oriented languages | |
2240 such as C++ is to write symbols in a mixed case format, where the first | |
2241 letter of each word is capitalized, and not separated by underscores. | |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
2242 e.g., @samp{SymbolsWithMixedCaseAndNoUnderlines}. |
25829 | 2243 |
2244 This command moves point forward to next capitalized word. With prefix | |
2245 argument @var{n}, move @var{n} times. | |
2246 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2247 @item @kbd{M-x c-backward-into-nomenclature} |
25829 | 2248 @findex c-backward-into-nomenclature |
2249 @findex backward-into-nomenclature (c-) | |
2250 Move point backward to beginning of the next capitalized | |
2251 word. With prefix argument @var{n}, move @var{n} times. If | |
2252 @var{n} is negative, move forward. | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2253 @end table |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2254 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2255 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2256 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2257 @node Other Commands, , Movement Commands, Commands |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2258 @comment node-name, next, previous, up |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2259 @section Other Commands |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2260 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2261 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2262 Here are the various other commands that didn't fit anywhere else: |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2263 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2264 @table @asis |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2265 @item @kbd{C-c :} (@code{c-scope-operator}) |
25829 | 2266 @kindex C-c : |
2267 @findex c-scope-operator | |
2268 @findex scope-operator (c-) | |
2269 In C++, it is also sometimes desirable to insert the double-colon scope | |
2270 operator without performing the electric behavior of colon insertion. | |
2271 @kbd{C-c :} does just this. | |
2272 @end table | |
2273 | |
2274 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2275 @node Customizing Indentation, Syntactic Symbols, Commands, Top |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2276 @comment node-name, next, previous, up |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2277 @chapter Customizing Indentation |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2278 @cindex customization, indentation |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2279 @cindex indentation |
25829 | 2280 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
2281 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2282 The context sensitive indentation is mainly controlled by the variable |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2283 @code{c-offsets-alist}: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2284 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2285 @defopt c-offsets-alist |
25829 | 2286 @vindex offsets-alist (c-) |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2287 This special style variable contains the mappings between syntactic |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2288 symbols and the offsets to apply for those symbols. It's set at mode |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2289 initialization from a @emph{style} you may specify. Styles are |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2290 groupings of syntactic symbol offsets and other style variable values. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2291 Most likely, you'll find that one of the predefined styles will suit |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2292 your needs. @xref{Styles}, for an explanation of how to set up named |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2293 styles. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2294 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2295 Only syntactic symbols not already bound on @code{c-offsets-alist} will |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2296 be set from styles. This means that any association you set on it, be |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2297 it before or after mode initialization, will not be changed. The |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
2298 @code{c-offsets-alist} variable may therefore be used from e.g., the |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2299 Customization interface@footnote{Available in Emacs 20 and later, and |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2300 XEmacs 19.15 and later.} to easily change indentation offsets without |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2301 having to bother about styles. Initially @code{c-offsets-alist} is |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2302 empty, so that all syntactic symbols are set by the style system. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2303 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2304 The offset associated with any particular syntactic symbol can be an |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2305 integer, a function or lambda expression, a variable name, a vector, a |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2306 list, or one of the following special symbols: @code{+}, @code{-}, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2307 @code{++}, @code{--}, @code{*}, or @code{/}. The meaning of these |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2308 values are described in detail below. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2309 @end defopt |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2310 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2311 The special symbols describe an offset in multiples of the value of |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2312 @code{c-basic-offset}: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2313 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2314 @defopt c-basic-offset |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2315 @vindex basic-offset (c-) |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2316 Style variable that holds the basic offset between indentation levels. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2317 @end defopt |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2318 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2319 By defining a style's indentation in terms of @code{c-basic-offset}, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2320 you can change the amount of whitespace given to an indentation level |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2321 while maintaining the same basic shape of your code. Here are the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2322 values that the special symbols correspond to: |
25829 | 2323 |
2324 @table @code | |
2325 @item + | |
2326 @code{c-basic-offset} times 1 | |
2327 @item - | |
2328 @code{c-basic-offset} times -1 | |
2329 @item ++ | |
2330 @code{c-basic-offset} times 2 | |
2331 @item -- | |
2332 @code{c-basic-offset} times -2 | |
2333 @item * | |
2334 @code{c-basic-offset} times 0.5 | |
2335 @item / | |
2336 @code{c-basic-offset} times -0.5 | |
2337 @end table | |
2338 | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2339 @cindex indentation functions |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2340 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2341 When a function is used as offset, it's called an @dfn{indentation |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2342 function}. Such functions are useful when more context than just the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2343 syntactic symbol is needed to get the desired indentation. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2344 @xref{Indentation Functions}, and @ref{Custom Indentation Functions}, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2345 for details about them. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2346 |
36923 | 2347 If the offset is a vector, its first element sets the absolute |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2348 indentation column, which will override any previous relative |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2349 indentation. It won't override additional relative indentation for |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2350 nested constructs, though. |
36923 | 2351 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2352 @vindex c-strict-syntax-p |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2353 @vindex strict-syntax-p (c-) |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2354 The offset can also be a list, in which case it is evaluated recursively |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2355 using the semantics described above. The first element of the list that |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2356 returns a non-@code{nil} value succeeds and the evaluation stops. If |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2357 none of the list elements return a non-@code{nil} value, then an offset |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2358 of 0 (zero) is used@footnote{There is however a variable |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2359 @code{c-strict-syntax-p} that, when set to non-@code{nil}, will cause an |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2360 error to be signalled in that case. It's now considered obsolete since |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2361 it doesn't work well with some of the alignment functions that now |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2362 returns @code{nil} instead of zero to be more usable in lists. You |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2363 should therefore leave @code{c-strict-syntax-p} set to @code{nil}.}. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2364 |
25829 | 2365 So, for example, because most of the default offsets are defined in |
2366 terms of @code{+}, @code{-}, and @code{0}, if you like the general | |
2367 indentation style, but you use 4 spaces instead of 2 spaces per level, | |
2368 you can probably achieve your style just by changing | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2369 @code{c-basic-offset} like so@footnote{You can try this interactively in |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2370 a C buffer by typing the text that appears in italics.}: |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2371 |
25829 | 2372 @example |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2373 @emph{M-x set-variable RET} |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2374 Set variable: @emph{c-basic-offset RET} |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2375 Set c-basic-offset to value: @emph{4 RET} |
25829 | 2376 @end example |
2377 | |
2378 @noindent | |
2379 This would change | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2380 |
25829 | 2381 @example |
2382 @group | |
2383 int add( int val, int incr, int doit ) | |
2384 @{ | |
2385 if( doit ) | |
2386 @{ | |
2387 return( val + incr ); | |
2388 @} | |
2389 return( val ); | |
2390 @} | |
2391 @end group | |
2392 @end example | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2393 |
25829 | 2394 @noindent |
2395 to | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2396 |
25829 | 2397 @example |
2398 @group | |
2399 int add( int val, int incr, int doit ) | |
2400 @{ | |
2401 if( doit ) | |
2402 @{ | |
2403 return( val + incr ); | |
2404 @} | |
2405 return( val ); | |
2406 @} | |
2407 @end group | |
2408 @end example | |
2409 | |
2410 To change indentation styles more radically, you will want to change the | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2411 offsets associated with other syntactic symbols. First, I'll show you |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2412 how to do that interactively, then I'll describe how to make changes to |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2413 your @file{.emacs} file so that your changes are more permanent. |
25829 | 2414 |
2415 @menu | |
2416 * Interactive Customization:: | |
2417 * Permanent Customization:: | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2418 * Hooks:: |
25829 | 2419 * Styles:: |
2420 * Advanced Customizations:: | |
2421 @end menu | |
2422 | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2423 |
25829 | 2424 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2425 @node Interactive Customization, Permanent Customization, , Customizing Indentation |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2426 @comment node-name, next, previous, up |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2427 @section Interactive Customization |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2428 @cindex customization, interactive |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2429 @cindex interactive customization |
25829 | 2430 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
2431 | |
2432 As an example of how to customize indentation, let's change the | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2433 style of this example@footnote{In this and subsequent examples, the |
25829 | 2434 original code is formatted using the @samp{gnu} style unless otherwise |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2435 indicated. @xref{Styles}.}: |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2436 |
25829 | 2437 @example |
2438 @group | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2439 1: int add( int val, int incr, int doit ) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2440 2: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2441 3: if( doit ) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2442 4: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2443 5: return( val + incr ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2444 6: @} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2445 7: return( val ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2446 8: @} |
25829 | 2447 @end group |
2448 @end example | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2449 |
25829 | 2450 @noindent |
2451 to: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2452 |
25829 | 2453 @example |
2454 @group | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2455 1: int add( int val, int incr, int doit ) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2456 2: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2457 3: if( doit ) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2458 4: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2459 5: return( val + incr ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2460 6: @} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2461 7: return( val ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2462 8: @} |
25829 | 2463 @end group |
2464 @end example | |
2465 | |
2466 In other words, we want to change the indentation of braces that open a | |
2467 block following a condition so that the braces line up under the | |
2468 conditional, instead of being indented. Notice that the construct we | |
2469 want to change starts on line 4. To change the indentation of a line, | |
2470 we need to see which syntactic components affect the offset calculations | |
2471 for that line. Hitting @kbd{C-c C-s} on line 4 yields: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2472 |
25829 | 2473 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2474 ((substatement-open 44)) |
25829 | 2475 @end example |
2476 | |
2477 @noindent | |
2478 so we know that to change the offset of the open brace, we need to | |
2479 change the indentation for the @code{substatement-open} syntactic | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2480 symbol. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2481 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2482 To do this interactively, just hit @kbd{C-c C-o}. This prompts |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2483 you for the syntactic symbol to change, providing a reasonable default. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2484 In this case, the default is @code{substatement-open}, which is just the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2485 syntactic symbol we want to change! |
25829 | 2486 |
2487 After you hit return, @ccmode{} will then prompt you for the new | |
2488 offset value, with the old value as the default. The default in this | |
2489 case is @samp{+}, but we want no extra indentation so enter | |
2490 @samp{0} and @kbd{RET}. This will associate the offset 0 with the | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2491 syntactic symbol @code{substatement-open}. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2492 |
25829 | 2493 To check your changes quickly, just hit @kbd{C-c C-q} |
2494 (@code{c-indent-defun}) to reindent the entire function. The example | |
2495 should now look like: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2496 |
25829 | 2497 @example |
2498 @group | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2499 1: int add( int val, int incr, int doit ) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2500 2: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2501 3: if( doit ) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2502 4: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2503 5: return( val + incr ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2504 6: @} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2505 7: return( val ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2506 8: @} |
25829 | 2507 @end group |
2508 @end example | |
2509 | |
2510 Notice how just changing the open brace offset on line 4 is all we | |
2511 needed to do. Since the other affected lines are indented relative to | |
2512 line 4, they are automatically indented the way you'd expect. For more | |
2513 complicated examples, this may not always work. The general approach to | |
2514 take is to always start adjusting offsets for lines higher up in the | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2515 file, then reindent and see if any following lines need further |
25829 | 2516 adjustments. |
2517 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2518 @deffn Command c-set-offset symbol offset |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2519 @findex set-offset (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2520 @kindex C-c C-o |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2521 This is the command bound to @kbd{C-c C-o}. It provides a convenient |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2522 way to set offsets on @code{c-offsets-alist} both interactively (see |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2523 the example above) and from your mode hook. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2524 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2525 It takes two arguments when used programmatically: @var{symbol} is the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2526 syntactic element symbol to change and @var{offset} is the new offset |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2527 for that syntactic element. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2528 @end deffn |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2529 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2530 |
25829 | 2531 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2532 @node Permanent Customization, Hooks, Interactive Customization, Customizing Indentation |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2533 @comment node-name, next, previous, up |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2534 @section Permanent Customization |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2535 @cindex customization, permanent |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2536 @cindex permanent customization |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2537 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2538 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2539 To make your changes permanent, you need to add some lisp code to your |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2540 @file{.emacs} file. @ccmode{} supports many different ways to be |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2541 configured, from the straightforward way by setting variables globally |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2542 in @file{.emacs} or in the Customization interface, to the complex and |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2543 precisely controlled way by using styles and hook functions. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2544 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2545 The simplest way of customizing @ccmode{} permanently is to set the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2546 variables in your @file{.emacs} with @code{setq} and similar commands. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2547 So to make a permanent setting of @code{substatement-open} to 0, add |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2548 this to the @file{.emacs} file: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2549 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2550 @example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2551 @group |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2552 (setq c-offsets-alist |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2553 '((substatement-open . 0))) |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2554 @end group |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2555 @end example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2556 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2557 When @ccmode{} initializes a buffer, it will fill out |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2558 @code{c-offsets-alist} with the remaining syntactic symbols according to |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2559 the style system. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2560 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2561 You can also use the more user friendly Customization interface, but |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2562 this manual does not cover how that works. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2563 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2564 Variables set like this at the top level in @file{.emacs} take effect in |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2565 all @ccmode{} buffers, regardless of language. The indentation style |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
2566 related variables, e.g., @code{c-offsets-alist}, that you don't set this |
30396
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
2567 way get their value from the style system (@pxref{Styles}), and they |
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
2568 therefore depend on the setting of @code{c-default-style}. Note that if |
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
2569 you use Customize, this means that the greyed-out default values |
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
2570 presented there might not be the ones you actually get, since the actual |
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
2571 values depend on the style, which may very well be different for |
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
2572 different languages. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2573 |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
2574 If you want to make more advanced configurations, e.g., language-specific |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2575 customization, setting global variables isn't enough. For that you can |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2576 use the language hooks, see @ref{Hooks}, and/or the style system, see |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2577 @ref{Styles}. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2578 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2579 @defopt c-style-variables-are-local-p |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2580 @vindex style-variables-are-local-p (c-) |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2581 By default, all style variables are buffer local, so that different |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2582 buffers can have different style settings. If you only use one style |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2583 in all the files you edit you might want to share them between buffers |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2584 so that a change take effect in all buffers. That's done by setting |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2585 this variable to @code{nil}. The value takes effect when @ccmode{} is |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2586 activated in a buffer for the first time in the Emacs session, so you |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2587 typically set it in your @file{.emacs} file and then restart Emacs. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2588 @end defopt |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2589 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2590 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2591 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2592 @node Hooks, Styles, Permanent Customization, Customizing Indentation |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2593 @comment node-name, next, previous, up |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2594 @section Hooks |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2595 @cindex mode hooks |
25829 | 2596 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
2597 | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2598 @ccmode{} provides several hooks that you can use to customize the mode |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2599 according to your coding style. Each language mode has its own hook, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2600 adhering to standard Emacs major mode conventions. There is also one |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2601 general hook and one package initialization hook: |
25829 | 2602 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2603 @defvar c-initialization-hook |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2604 @vindex initialization-hook (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2605 Hook run only once per Emacs session, when @ccmode{} is initialized. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2606 @end defvar |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2607 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2608 @defvar c-mode-common-hook |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2609 @vindex mode-common-hook (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2610 Common hook across all languages. It's run immediately before the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2611 language specific hook. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2612 @end defvar |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2613 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2614 @defvar c-mode-hook |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2615 @defvarx c++-mode-hook |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2616 @defvarx objc-mode-hook |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2617 @defvarx java-mode-hook |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2618 @defvarx idl-mode-hook |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2619 @defvarx pike-mode-hook |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2620 @defvarx awk-mode-hook |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2621 The language specific mode hooks. The appropriate one is run as the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2622 last thing when you enter that language mode. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2623 @end defvar |
36923 | 2624 |
2625 Note that all the language-specific mode setup that CC Mode does is done | |
2626 prior to both @code{c-mode-common-hook} and the language specific hook. | |
2627 That includes installing the indentation style, which can be mode | |
2628 specific (and also is by default for Java mode). Thus, any style | |
2629 settings done in @code{c-mode-common-hook} will override whatever | |
2630 language-specific style is chosen by @code{c-default-style}. | |
25829 | 2631 |
2632 Here's a simplified example of what you can add to your @file{.emacs} | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2633 file to do things whenever any @ccmode{} language is edited. See the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2634 Emacs manuals for more information on customizing Emacs via hooks. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2635 @xref{Sample .emacs File}, for a more complete sample @file{.emacs} |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2636 file. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2637 |
25829 | 2638 @example |
2639 (defun my-c-mode-common-hook () | |
2640 ;; my customizations for all of c-mode and related modes | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2641 (no-case-fold-search) |
25829 | 2642 ) |
2643 (add-hook 'c-mode-common-hook 'my-c-mode-common-hook) | |
2644 @end example | |
2645 | |
2646 | |
2647 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2648 @node Styles, Advanced Customizations, Hooks, Customizing Indentation |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2649 @comment node-name, next, previous, up |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2650 @section Styles |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2651 @cindex styles |
25829 | 2652 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
2653 | |
2654 Most people only need to edit code formatted in just a few well-defined | |
2655 and consistent styles. For example, their organization might impose a | |
2656 ``blessed'' style that all its programmers must conform to. Similarly, | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2657 people who work on GNU software will have to use the GNU coding style. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2658 Some shops are more lenient, allowing a variety of coding styles, and as |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2659 programmers come and go, there could be a number of styles in use. For |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2660 this reason, @ccmode{} makes it convenient for you to set up logical |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2661 groupings of customizations called @dfn{styles}, associate a single name |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2662 for any particular style, and pretty easily start editing new or |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2663 existing code using these styles. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2664 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2665 @cindex style variables |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2666 The variables that the style system affect are called @dfn{style |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2667 variables}. They are handled specially in several ways: |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2668 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2669 @itemize @bullet |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2670 @item |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2671 Style variables are by default buffer local variables. However, they |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2672 can instead be made global by setting |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2673 @code{c-style-variables-are-local-p} to @code{nil} before @ccmode{} is |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2674 initialized. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2675 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2676 @item |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2677 @vindex c-old-style-variable-behavior |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2678 @vindex old-style-variable-behavior (c-) |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2679 The default value of any style variable (with two exceptions --- see |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2680 below) is the special symbol @code{set-from-style}. Variables that are |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2681 still set to that symbol when a @ccmode{} buffer is initialized will be |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2682 set according to the current style, otherwise they will keep their |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2683 current value@footnote{This is a big change from versions of @ccmode{} |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2684 earlier than 5.26, where such settings would get overridden by the style |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2685 system unless special precautions were taken. That was changed since it |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2686 was counterintuitive and confusing, especially to novice users. If your |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2687 configuration depends on the old overriding behavior, you can set the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2688 variable @code{c-old-style-variable-behavior} to non-@code{nil}.}. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2689 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2690 Note that when we talk about the ``default value'' for a style variable, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2691 we don't mean the @code{set-from-style} symbol that all style variables |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2692 are set to initially, but instead the value it will get at mode |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2693 initialization when neither a style nor a global setting has set its |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2694 value. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2695 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2696 The style variable @code{c-offsets-alist} is handled a little |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2697 differently from the other style variables. It's an association list, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2698 and is thus by default set to the empty list, @code{nil}. When the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2699 style system is initialized, any syntactic symbols already on it are |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2700 kept --- only the missing ones are filled in from the chosen style. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2701 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2702 The style variable @code{c-special-indent-hook} is also handled in a |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2703 special way. Styles may only add more functions on this hook, so the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2704 global settings on it are always preserved@footnote{This did not change |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2705 in version 5.26.}. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2706 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2707 @item |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2708 The global settings of style variables get captured in the special |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2709 @code{user} style, which is used as the base for all the other styles. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2710 @xref{Built-in Styles}, for details. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2711 @end itemize |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2712 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2713 The style variables are: |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2714 @code{c-basic-offset}, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2715 @code{c-comment-only-line-offset}, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2716 @code{c-block-comment-prefix}, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2717 @code{c-comment-prefix-regexp}, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2718 @code{c-cleanup-list}, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2719 @code{c-hanging-braces-alist}, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2720 @code{c-hanging-colons-alist}, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2721 @code{c-hanging-semi&comma-criteria}, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2722 @code{c-backslash-column}, |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2723 @code{c-backslash-max-column}, |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2724 @code{c-special-indent-hook}, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2725 @code{c-label-minimum-indentation}, and |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2726 @code{c-offsets-alist}. |
25829 | 2727 |
2728 @menu | |
2729 * Built-in Styles:: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2730 * Choosing a Style:: |
25829 | 2731 * Adding Styles:: |
2732 * File Styles:: | |
2733 @end menu | |
2734 | |
2735 | |
2736 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2737 @node Built-in Styles, Choosing a Style, , Styles |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2738 @comment node-name, next, previous, up |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2739 @subsection Built-in Styles |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2740 @cindex styles, built-in |
25829 | 2741 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
2742 | |
2743 If you're lucky, one of @ccmode{}'s built-in styles might be just | |
2744 what you're looking for. These include: | |
2745 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2746 @table @code |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2747 @item gnu |
25829 | 2748 @cindex GNU style |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2749 Coding style blessed by the Free Software Foundation |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2750 for C code in GNU programs. |
25829 | 2751 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2752 @item k&r |
25829 | 2753 @cindex K&R style |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2754 The classic Kernighan and Ritchie style for C code. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2755 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2756 @item bsd |
25829 | 2757 @cindex BSD style |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2758 Also known as ``Allman style'' after Eric Allman. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2759 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2760 @item whitesmith |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2761 @cindex Whitesmith style |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2762 Popularized by the examples that came with Whitesmiths C, an early |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2763 commercial C compiler. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2764 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2765 @item stroustrup |
25829 | 2766 @cindex Stroustrup style |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2767 The classic Stroustrup style for C++ code. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2768 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2769 @item ellemtel |
25829 | 2770 @cindex Ellemtel style |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2771 Popular C++ coding standards as defined by ``Programming in C++, Rules |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2772 and Recommendations,'' Erik Nyquist and Mats Henricson, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2773 Ellemtel@footnote{This document is available at |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2774 @uref{http://www.doc.ic.ac.uk/lab/cplus/c++.rules/} among other |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2775 places.}. |
25829 | 2776 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2777 @item linux |
25829 | 2778 @cindex Linux style |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2779 C coding standard for Linux (the kernel). |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2780 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2781 @item python |
25829 | 2782 @cindex Python style |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2783 C coding standard for Python extension modules@footnote{Python is a |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2784 high level scripting language with a C/C++ foreign function interface. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2785 For more information, see @uref{http://www.python.org/}.}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2786 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2787 @item java |
25829 | 2788 @cindex Java style |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2789 The style for editing Java code. Note that the default |
36923 | 2790 value for @code{c-default-style} installs this style when you enter |
2791 @code{java-mode}. | |
25829 | 2792 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2793 @item user |
25829 | 2794 @cindex User style |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2795 This is a special style for several reasons. First, the |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2796 @ccmode{} customizations you do by using either the Customization |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2797 interface, or by writing @code{setq}'s at the top level of your |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2798 @file{.emacs} file, will be captured in the @code{user} style. Also, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2799 all other styles implicitly inherit their settings from @code{user} |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2800 style. This means that for any styles you add via @code{c-add-style} |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2801 (@pxref{Adding Styles}) you need only define the differences between |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2802 your new style and @code{user} style. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2803 @end table |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2804 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2805 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2806 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2807 @node Choosing a Style, Adding Styles, Built-in Styles, Styles |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2808 @comment node-name, next, previous, up |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2809 @subsection Choosing a Style |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2810 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2811 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2812 Use @kbd{C-c .} to choose a style interactively: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2813 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2814 @deffn Command c-set-style style-name |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2815 @findex set-style (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2816 @kindex C-c . |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2817 Switch to the specified style in the current buffer. Use |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2818 interactively like this: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2819 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2820 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2821 @kbd{C-c . @var{style-name} RET} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2822 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2823 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2824 Note that all style names are case insensitive, even the ones you |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2825 define. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2826 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2827 Setting a style in this way does @emph{not} automatically reindent your |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2828 file. For commands that you can use to view the effect of your changes, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2829 see @ref{Commands}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2830 @end deffn |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2831 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2832 The default style in all newly created buffers is @code{gnu}, except |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2833 in Java mode where it's @code{java}. Although the @code{user} style |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2834 is not the default style, any style variable settings you do with the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2835 Customization interface or on the top level in your @file{.emacs} file |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2836 will by default override the style system, so you don't need to set |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2837 @code{c-default-style} to @code{user} to see the effect of such |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2838 settings. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2839 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2840 @defopt c-default-style |
25829 | 2841 @vindex default-style (c-) |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2842 This variable specifies which style to install by default in new |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2843 buffers. It takes either a style name string, or an association list |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2844 of major mode symbols to style names: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2845 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2846 @enumerate |
25829 | 2847 @item |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2848 When @code{c-default-style} is a string, it must be an existing style |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2849 name. This style is then used for all modes. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2850 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2851 @item |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2852 When @code{c-default-style} is an association list, the mode language |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2853 is looked up to find a style name string. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2854 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2855 @item |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2856 If @code{c-default-style} is an association list where the mode |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2857 language mode isn't found then the special symbol @samp{other} is |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2858 looked up. If it's found then the associated style is used. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2859 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2860 @item |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2861 If @samp{other} is not found then the @samp{gnu} style is used. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2862 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2863 @item |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2864 In all cases, the style described in @code{c-default-style} is installed |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2865 @emph{before} the language hooks are run, so you can always override |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2866 this setting by including an explicit call to @code{c-set-style} in your |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2867 language mode hook, or in @code{c-mode-common-hook}. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2868 @end enumerate |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2869 @end defopt |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2870 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2871 @defvar c-indentation-style |
25829 | 2872 @vindex indentation-style (c-) |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2873 This variable always contains the buffer's current style name, as a |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2874 string. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2875 @end defvar |
25829 | 2876 |
2877 | |
2878 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2879 @node Adding Styles, File Styles, Choosing a Style, Styles |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2880 @comment node-name, next, previous, up |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2881 @subsection Adding Styles |
25829 | 2882 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
2883 | |
2884 If none of the built-in styles is appropriate, you'll probably want to | |
2885 add a new @dfn{style definition}. Styles are kept in the | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2886 @code{c-style-alist} variable, but you should never modify this |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2887 variable directly. Instead, @ccmode{} provides the function |
25829 | 2888 @code{c-add-style} that you can use to easily add new styles or change |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2889 existing styles: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2890 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2891 @defun c-add-style stylename description &optional set-p |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2892 @findex add-style (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2893 Add or update a style. If @var{stylename} is not already in |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2894 @code{c-style-alist} then a new style according to @var{description} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2895 is added, otherwise the existing style is changed. If the optional |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2896 @var{set-p} is non-@code{nil} then the new style is applied to the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2897 current buffer as well. |
25829 | 2898 |
2899 @comment TBD: The next paragraph is bogus. I really need to better | |
2900 @comment document adding styles, including setting up inherited styles. | |
2901 | |
2902 The sample @file{.emacs} file provides a concrete example of how a new | |
2903 style can be added and automatically set. @xref{Sample .emacs File}. | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2904 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2905 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2906 @defvar c-style-alist |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2907 @vindex style-alist (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2908 This is the variable that holds the definitions for the styles. It |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2909 should not be changed directly; use @code{c-add-style} instead. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2910 @end defvar |
25829 | 2911 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2912 |
25829 | 2913 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2914 @node File Styles, , Adding Styles, Styles |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2915 @comment node-name, next, previous, up |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2916 @subsection File Styles |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2917 @cindex styles, file local |
25829 | 2918 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
2919 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2920 @cindex file local variables |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2921 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2922 The Emacs manual describes how you can customize certain variables on |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2923 a per-file basis by including a @dfn{file local variable} block at the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2924 end of the file. So far, you've only seen a functional interface to |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2925 @ccmode{} customization, which can't be used there. @ccmode{} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2926 provides two variables allow customization of the indentation style on |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2927 a per-file basis: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2928 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2929 @defvar c-file-style |
25829 | 2930 @vindex file-style (c-) |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2931 This variable can be set to a style name string. When the file is |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2932 visited, @ccmode{} will automatically set the file's style to this |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2933 one using @code{c-set-style}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2934 @end defvar |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2935 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2936 @defvar c-file-offsets |
25829 | 2937 @vindex file-offsets (c-) |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2938 This variable takes an association list similar to what is allowed in |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2939 @code{c-offsets-alist}. When the file is visited, @ccmode{} will |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2940 automatically institute these offsets using @code{c-set-offset}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2941 @end defvar |
25829 | 2942 |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
2943 Note that file style settings (i.e., @code{c-file-style}) are applied |
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
2944 before file offset settings (i.e., @code{c-file-offsets}). Also, if |
25829 | 2945 either of these are set in a file's local variable section, all the |
2946 style variable values are made local to that buffer. | |
2947 | |
2948 | |
2949 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2950 @node Advanced Customizations, , Styles, Customizing Indentation |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2951 @comment node-name, next, previous, up |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2952 @section Advanced Customizations |
25829 | 2953 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
2954 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2955 For most users, @ccmode{} will support their coding styles with very |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2956 little need for more advanced customizations. Usually, one of the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2957 standard styles (@pxref{Built-in Styles}) will do the trick. At most, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2958 perhaps one of the syntactic symbol offsets will need to be tweaked |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2959 slightly, or maybe @code{c-basic-offset} will need to be changed. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2960 However, some styles require a more flexible framework for |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2961 customization, and one of the real strengths of @ccmode{} is that the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2962 syntactic analysis model provides just such a framework. This allows |
25829 | 2963 you to implement custom indentation calculations for situations not |
2964 handled by the mode directly. | |
2965 | |
2966 @menu | |
2967 * Custom Indentation Functions:: | |
2968 * Custom Brace and Colon Hanging:: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2969 * Customizing Semicolons and Commas:: |
25829 | 2970 * Other Special Indentations:: |
2971 @end menu | |
2972 | |
2973 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2974 @node Custom Indentation Functions, Custom Brace and Colon Hanging, , Advanced Customizations |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2975 @comment node-name, next, previous, up |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2976 @subsection Custom Indentation Functions |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2977 @cindex customization, indentation functions |
25829 | 2978 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
2979 | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2980 The most flexible way to customize @ccmode{} is by writing custom |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2981 indentation functions, and associating them with specific syntactic |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2982 symbols (@pxref{Syntactic Symbols}). @ccmode{} itself uses indentation |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2983 functions to provide more sophisticated indentation, for example when |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
2984 lining up C++ stream operator blocks: |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2985 |
25829 | 2986 @example |
2987 @group | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2988 1: void main(int argc, char**) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2989 2: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2990 3: cout << "There were " |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2991 4: << argc |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2992 5: << "arguments passed to the program" |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2993 6: << endl; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
2994 7: @} |
25829 | 2995 @end group |
2996 @end example | |
2997 | |
2998 In this example, lines 4 through 6 are assigned the @code{stream-op} | |
2999 syntactic symbol. Here, @code{stream-op} has an offset of @code{+}, and | |
3000 with a @code{c-basic-offset} of 2, you can see that lines 4 through 6 | |
3001 are simply indented two spaces to the right of line 3. But perhaps we'd | |
3002 like @ccmode{} to be a little more intelligent so that it aligns | |
3003 all the @samp{<<} symbols in lines 3 through 6. To do this, we have | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3004 to write a custom indentation function which finds the column of the first |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3005 stream operator on the first line of the statement. Here is sample |
25829 | 3006 lisp code implementing this: |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3007 |
25829 | 3008 @example |
3009 (defun c-lineup-streamop (langelem) | |
3010 (save-excursion | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3011 (goto-char (cdr langelem)) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3012 (re-search-forward "<<\\|>>" (c-point 'eol) 'move) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3013 (goto-char (match-beginning 0)) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3014 (vector (current-column)))) |
25829 | 3015 @end example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3016 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3017 Indentation functions take a single argument, which is a syntactic |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3018 component cons cell (@pxref{Syntactic Analysis}). The function can |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3019 return an integer which is added to the running total indentation for |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3020 the line, or a vector containing an integer which is an absolute |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3021 column to align to. Usually an absolute column is wanted when |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3022 aligning to existing text, as in this example. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3023 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3024 The function should return @code{nil} if it's used in a situation where |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3025 it doesn't want to make any decision. If the function is used in a list |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3026 expression (@pxref{Customizing Indentation}), that will cause @ccmode{} |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3027 to go on and check the next entry in the list. |
25829 | 3028 |
3029 Now, to associate the function @code{c-lineup-streamop} with the | |
3030 @code{stream-op} syntactic symbol, we can add something like the | |
3031 following to our @code{c++-mode-hook}@footnote{It probably makes more | |
3032 sense to add this to @code{c++-mode-hook} than @code{c-mode-common-hook} | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3033 since stream operators are only relevant for C++.}: |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3034 |
25829 | 3035 @example |
3036 (c-set-offset 'stream-op 'c-lineup-streamop) | |
3037 @end example | |
3038 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3039 Now the function looks like this after reindenting (using @kbd{C-c |
25829 | 3040 C-q}): |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3041 |
25829 | 3042 @example |
3043 @group | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3044 1: void main(int argc, char**) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3045 2: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3046 3: cout << "There were " |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3047 4: << argc |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3048 5: << " arguments passed to the program" |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3049 6: << endl; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3050 7: @} |
25829 | 3051 @end group |
3052 @end example | |
3053 | |
3054 Custom indentation functions can be as simple or as complex as you like, | |
3055 and any syntactic symbol that appears in @code{c-offsets-alist} can have | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3056 a custom indentation function associated with it. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3057 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3058 @ccmode{} comes with an extensive set of predefined indentation |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3059 functions, not all of which are used by the default styles. So there's |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3060 a good chance the function you want already exists. @xref{Indentation |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3061 Functions}, for a list of them. If you have written an indentation |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3062 function that you think is generally useful, you're very welcome to |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3063 contribute it; please contact @email{bug-cc-mode@@gnu.org}. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3064 |
25829 | 3065 |
3066 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3067 @node Custom Brace and Colon Hanging, Customizing Semicolons and Commas, Custom Indentation Functions, Advanced Customizations |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3068 @comment node-name, next, previous, up |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3069 @subsection Custom Brace and Colon Hanging |
25829 | 3070 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
3071 | |
3072 @vindex c-hanging-braces-alist | |
3073 @vindex hanging-braces-alist (c-) | |
3074 Syntactic symbols aren't the only place where you can customize | |
3075 @ccmode{} with the lisp equivalent of callback functions. Brace | |
3076 ``hanginess'' can also be determined by custom functions associated with | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3077 syntactic symbols on the @code{c-hanging-braces-alist} style variable. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3078 Remember that @var{action}'s are typically a list containing some |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3079 combination of the symbols @code{before} and @code{after} |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3080 (@pxref{Hanging Braces}). However, an @var{action} can also be a |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3081 function which gets called when a brace matching that syntactic symbol |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3082 is entered. |
25829 | 3083 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3084 @cindex customization, brace hanging |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3085 These @var{action} functions are called with two arguments: the |
25829 | 3086 syntactic symbol for the brace, and the buffer position at which the |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3087 brace was inserted. The @var{action} function is expected to return a |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3088 list containing some combination of @code{before} and @code{after}, |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
3089 including neither of them (i.e., @code{nil}). This return value has the |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3090 normal brace hanging semantics. |
25829 | 3091 |
3092 As an example, @ccmode{} itself uses this feature to dynamically | |
3093 determine the hanginess of braces which close ``do-while'' | |
3094 constructs: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3095 |
25829 | 3096 @example |
3097 void do_list( int count, char** atleast_one_string ) | |
3098 @{ | |
3099 int i=0; | |
3100 do @{ | |
3101 handle_string( atleast_one_string[i] ); | |
3102 i++; | |
3103 @} while( i < count ); | |
3104 @} | |
3105 @end example | |
3106 | |
3107 @ccmode{} assigns the @code{block-close} syntactic symbol to the | |
3108 brace that closes the @code{do} construct, and normally we'd like the | |
3109 line that follows a @code{block-close} brace to begin on a separate | |
3110 line. However, with ``do-while'' constructs, we want the | |
3111 @code{while} clause to follow the closing brace. To do this, we | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3112 associate the @code{block-close} symbol with the @var{action} function |
25829 | 3113 @code{c-snug-do-while}: |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3114 |
25829 | 3115 @example |
3116 (defun c-snug-do-while (syntax pos) | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3117 "Dynamically calculate brace hanginess for do-while statements." |
25829 | 3118 (save-excursion |
3119 (let (langelem) | |
3120 (if (and (eq syntax 'block-close) | |
3121 (setq langelem (assq 'block-close c-syntactic-context)) | |
3122 (progn (goto-char (cdr langelem)) | |
3123 (if (= (following-char) ?@{) | |
3124 (forward-sexp -1)) | |
3125 (looking-at "\\<do\\>[^_]"))) | |
3126 '(before) | |
3127 '(before after))))) | |
3128 @end example | |
3129 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3130 @findex c-snug-do-while |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3131 @findex snug-do-while (c-) |
25829 | 3132 This function simply looks to see if the brace closes a ``do-while'' |
3133 clause and if so, returns the list @samp{(before)} indicating | |
3134 that a newline should be inserted before the brace, but not after it. | |
3135 In all other cases, it returns the list @samp{(before after)} so | |
3136 that the brace appears on a line by itself. | |
3137 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3138 @defvar c-syntactic-context |
25829 | 3139 @vindex syntactic-context (c-) |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3140 During the call to the indentation or brace hanging @var{action} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3141 function, this variable is bound to the full syntactic analysis list. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3142 @end defvar |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3143 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3144 @cindex customization, colon hanging |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3145 @vindex c-hanging-colons-alist |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3146 @vindex hanging-colons-alist (c-) |
25829 | 3147 Note that for symmetry, colon hanginess should be customizable by |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3148 allowing function symbols as @var{action}s on the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3149 @code{c-hanging-colons-alist} style variable. Since no use has actually |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3150 been found for this feature, it isn't currently implemented! |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3151 |
25829 | 3152 |
3153 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3154 @node Customizing Semicolons and Commas, Other Special Indentations, Custom Brace and Colon Hanging, Advanced Customizations |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3155 @comment node-name, next, previous, up |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3156 @subsection Customizing Semicolons and Commas |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3157 @cindex customization, semicolon newlines |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3158 @cindex customization, comma newlines |
25829 | 3159 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
3160 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3161 You can also customize the insertion of newlines after semicolons and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3162 commas when the auto-newline minor mode is enabled (@pxref{Minor |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3163 Modes}). |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3164 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3165 @defopt c-hanging-semi&comma-criteria |
25829 | 3166 @vindex hanging-semi&comma-criteria (c-) |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3167 This style variable takes a list of hooks that get called when a |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3168 semicolon or comma is inserted. The hooks are called in order without |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3169 arguments, and are expected to return one of the following values: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3170 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3171 @table @code |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3172 @item t |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3173 A newline is inserted, and no more functions from the list are called. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3174 @item stop |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3175 No more functions from the list are called, but no newline is |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3176 inserted. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3177 @item nil |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3178 No determination is made, and the next function in the list is called. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3179 @end table |
25829 | 3180 |
3181 If every function in the list is called without a determination being | |
3182 made, then no newline is added. The default value for this variable is a | |
3183 list containing a single function which inserts newlines only after | |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
3184 semicolons which do not appear inside parenthesis lists (i.e., those |
25829 | 3185 that separate @code{for}-clause statements). |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3186 @end defopt |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3187 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3188 @defun c-semi&comma-no-newlines-before-nonblanks |
25829 | 3189 @findex semi&comma-no-newlines-before-nonblanks (c-) |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3190 This is an example of a criteria function, provided by @ccmode{}. It |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3191 prevents newlines from being inserted after semicolons when there is a |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3192 non-blank following line. Otherwise, it makes no determination. To |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3193 use, add this function to the front of the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3194 @code{c-hanging-semi&comma-criteria} list. |
25829 | 3195 |
3196 @example | |
3197 (defun c-semi&comma-no-newlines-before-nonblanks () | |
3198 (save-excursion | |
3199 (if (and (eq last-command-char ?\;) | |
3200 (zerop (forward-line 1)) | |
3201 (not (looking-at "^[ \t]*$"))) | |
3202 'stop | |
3203 nil))) | |
3204 @end example | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3205 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3206 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3207 @defun c-semi&comma-inside-parenlist |
25829 | 3208 @findex semi&comma-inside-parenlist (c-) |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3209 @defunx c-semi&comma-no-newlines-for-oneline-inliners |
25829 | 3210 @findex semi&comma-no-newlines-for-oneline-inliners (c-) |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3211 The function @code{c-semi&comma-inside-parenlist} is what prevents |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3212 newlines from being inserted inside the parenthesis list of @code{for} |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3213 statements. In addition to |
25829 | 3214 @code{c-semi&comma-no-newlines-before-nonblanks} described above, |
3215 @ccmode{} also comes with the criteria function | |
3216 @code{c-semi&comma-no-newlines-for-oneline-inliners}, which suppresses | |
3217 newlines after semicolons inside one-line inline method definitions | |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
3218 (e.g., in C++ or Java). |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3219 @end defun |
25829 | 3220 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3221 |
25829 | 3222 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3223 @node Other Special Indentations, , Customizing Semicolons and Commas, Advanced Customizations |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3224 @comment node-name, next, previous, up |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3225 @subsection Other Special Indentations |
25829 | 3226 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
3227 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3228 Here are the remaining odds and ends regarding indentation: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3229 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3230 @defopt c-label-minimum-indentation |
25829 | 3231 @vindex label-minimum-indentation (c-) |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3232 In @samp{gnu} style (@pxref{Built-in Styles}), a minimum indentation |
25829 | 3233 is imposed on lines inside top-level constructs. This minimum |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3234 indentation is controlled by this style variable. The default value |
25829 | 3235 is 1. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3236 @end defopt |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3237 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3238 @defopt c-special-indent-hook |
25829 | 3239 @vindex special-indent-hook (c-) |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3240 This style variable is a standard hook variable that is called after |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3241 every line is indented by @ccmode{}. You can use it to do any special |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3242 indentation or line adjustments your style dictates, such as adding |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3243 extra indentation to constructors or destructor declarations in a |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3244 class definition, etc. Note that you should not change point or mark |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
3245 inside your @code{c-special-indent-hook} functions, i.e., you'll |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3246 probably want to wrap your function in a @code{save-excursion}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3247 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3248 Setting @code{c-special-indent-hook} in your style definition is |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3249 handled slightly differently than other variables. In your style |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3250 definition, you should set the value for @code{c-special-indent-hook} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3251 to a function or list of functions, which will be appended to |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3252 @code{c-special-indent-hook} using @code{add-hook}. That way, the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3253 current setting for the buffer local value of |
25829 | 3254 @code{c-special-indent-hook} won't be overridden. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3255 @end defopt |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3256 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3257 |
25829 | 3258 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3259 @node Syntactic Symbols, Indentation Functions, Customizing Indentation, Top |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3260 @comment node-name, next, previous, up |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3261 @chapter Syntactic Symbols |
25829 | 3262 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
3263 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3264 @cindex syntactic symbols, brief list |
25829 | 3265 @vindex c-offsets-alist |
3266 @vindex offsets-alist (c-) | |
3267 Here is a complete list of the recognized syntactic symbols as described | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3268 in the @code{c-offsets-alist} style variable, along with a brief |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3269 description. More detailed descriptions follow. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3270 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3271 @table @code |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3272 @item string |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3273 Inside a multiline string. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3274 @item c |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3275 Inside a multiline C style block comment. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3276 @item defun-open |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3277 Brace that opens a top-level function definition. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3278 @item defun-close |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3279 Brace that closes a top-level function definition. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3280 @item defun-block-intro |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3281 The first line in a top-level defun. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3282 @item class-open |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3283 Brace that opens a class definition. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3284 @item class-close |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3285 Brace that closes a class definition. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3286 @item inline-open |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3287 Brace that opens an in-class inline method. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3288 @item inline-close |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3289 Brace that closes an in-class inline method. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3290 @item func-decl-cont |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3291 The region between a function definition's argument list and the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3292 function opening brace (excluding K&R argument declarations). In C, you |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3293 cannot put anything but whitespace and comments in this region, however |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3294 in C++ and Java, @code{throws} declarations and other things can appear |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3295 here. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3296 @item knr-argdecl-intro |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3297 First line of a K&R C argument declaration. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3298 @item knr-argdecl |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3299 Subsequent lines in a K&R C argument declaration. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3300 @item topmost-intro |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3301 The first line in a ``topmost'' definition. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3302 @item topmost-intro-cont |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3303 Topmost definition continuation lines. This is only used in the parts |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3304 that aren't covered by other symbols such as @code{func-decl-cont} and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3305 @code{knr-argdecl}. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3306 @item member-init-intro |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3307 First line in a member initialization list. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3308 @item member-init-cont |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3309 Subsequent member initialization list lines. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3310 @item inher-intro |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3311 First line of a multiple inheritance list. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3312 @item inher-cont |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3313 Subsequent multiple inheritance lines. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3314 @item block-open |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3315 Statement block open brace. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3316 @item block-close |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3317 Statement block close brace. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3318 @item brace-list-open |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3319 Open brace of an enum or static array list. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3320 @item brace-list-close |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3321 Close brace of an enum or static array list. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3322 @item brace-list-intro |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3323 First line in an enum or static array list. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3324 @item brace-list-entry |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3325 Subsequent lines in an enum or static array list. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3326 @item brace-entry-open |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3327 Subsequent lines in an enum or static array list where the line begins |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3328 with an open brace. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3329 @item statement |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3330 A statement. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3331 @item statement-cont |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3332 A continuation of a statement. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3333 @item statement-block-intro |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3334 The first line in a new statement block. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3335 @item statement-case-intro |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3336 The first line in a case block. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3337 @item statement-case-open |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3338 The first line in a case block that starts with a brace. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3339 @item substatement |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3340 The first line after a conditional or loop construct. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3341 @item substatement-open |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3342 The brace that opens a substatement block. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3343 @item substatement-label |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3344 The first line after a conditional or loop construct if it's a label. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3345 @item case-label |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3346 A label in a @code{switch} block. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3347 @item access-label |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3348 C++ access control label. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3349 @item label |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3350 Any other label. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3351 @item do-while-closure |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3352 The @code{while} line that ends a @code{do}-@code{while} construct. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3353 @item else-clause |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3354 The @code{else} line of an @code{if}-@code{else} construct. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3355 @item catch-clause |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3356 The @code{catch} or @code{finally} (in Java) line of a |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3357 @code{try}-@code{catch} construct. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3358 @item comment-intro |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3359 A line containing only a comment introduction. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3360 @item arglist-intro |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3361 The first line in an argument list. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3362 @item arglist-cont |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3363 Subsequent argument list lines when no arguments follow on the same line |
36341
0ab4e667274d
(Syntactic Symbols): Remove doubled `the'.
Gerd Moellmann <gerd@gnu.org>
parents:
36160
diff
changeset
|
3364 as the arglist opening paren. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3365 @item arglist-cont-nonempty |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3366 Subsequent argument list lines when at least one argument follows on the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3367 same line as the arglist opening paren. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3368 @item arglist-close |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3369 The solo close paren of an argument list. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3370 @item stream-op |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3371 Lines continuing a stream operator (C++ only). |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3372 @item inclass |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3373 The line is nested inside a class definition. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3374 @item cpp-macro |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3375 The start of a preprocessor macro definition. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3376 @item cpp-define-intro |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3377 The first line inside a multiline preproprocessor macro if |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3378 @code{c-syntactic-indentation-in-macros} is set. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3379 @item cpp-macro-cont |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3380 All lines inside multiline preprocessor macros if |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3381 @code{c-syntactic-indentation-in-macros} is @code{nil}. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3382 @item friend |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3383 A C++ friend declaration. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3384 @item objc-method-intro |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3385 The first line of an Objective-C method definition. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3386 @item objc-method-args-cont |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3387 Lines continuing an Objective-C method definition. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3388 @item objc-method-call-cont |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3389 Lines continuing an Objective-C method call. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3390 @item extern-lang-open |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
3391 Brace that opens an @code{extern} block (e.g., @code{extern "C" @{...@}}). |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3392 @item extern-lang-close |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3393 Brace that closes an @code{extern} block. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3394 @item inextern-lang |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3395 Analogous to @code{inclass} syntactic symbol, but used inside |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3396 @code{extern} blocks. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3397 @item namespace-open |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3398 @itemx namespace-close |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3399 @itemx innamespace |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3400 These are analogous to the three @code{extern-lang} symbols above, but |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3401 are returned for C++ namespace blocks. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3402 @item module-open |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3403 @itemx module-close |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3404 @itemx inmodule |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3405 Analogous to the above, but for CORBA IDL @code{module} blocks. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3406 @item composition-open |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3407 @itemx composition-close |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3408 @itemx incomposition |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3409 Analogous to the above, but for CORBA CIDL @code{composition} blocks. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3410 @item template-args-cont |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3411 C++ template argument list continuations. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3412 @item inlambda |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3413 Analogous to @code{inclass} syntactic symbol, but used inside lambda |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
3414 (i.e., anonymous) functions. Only used in Pike mode. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3415 @item lambda-intro-cont |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
3416 Lines continuing the header of a lambda function, i.e., between the |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3417 @code{lambda} keyword and the function body. Only used in Pike mode. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3418 @item inexpr-statement |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3419 A statement block inside an expression. The gcc C extension of this is |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3420 recognized. It's also used for the special functions that takes a |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3421 statement block as an argument in Pike. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3422 @item inexpr-class |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3423 A class definition inside an expression. This is used for anonymous |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3424 classes in Java. It's also used for anonymous array initializers in |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3425 Java. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3426 @end table |
25829 | 3427 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3428 @ssindex -open symbols |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3429 @ssindex -close symbols |
25829 | 3430 Most syntactic symbol names follow a general naming convention. When a |
3431 line begins with an open or close brace, the syntactic symbol will | |
3432 contain the suffix @code{-open} or @code{-close} respectively. | |
3433 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3434 @ssindex -intro symbols |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3435 @ssindex -cont symbols |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3436 @ssindex -block-intro symbols |
25829 | 3437 Usually, a distinction is made between the first line that introduces a |
3438 construct and lines that continue a construct, and the syntactic symbols | |
3439 that represent these lines will contain the suffix @code{-intro} or | |
3440 @code{-cont} respectively. As a sub-classification of this scheme, a | |
3441 line which is the first of a particular brace block construct will | |
3442 contain the suffix @code{-block-intro}. | |
3443 | |
3444 Let's look at some examples to understand how this works. Remember that | |
3445 you can check the syntax of any line by using @kbd{C-c C-s}. | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3446 |
25829 | 3447 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3448 1: void |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3449 2: swap( int& a, int& b ) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3450 3: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3451 4: int tmp = a; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3452 5: a = b; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3453 6: b = tmp; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3454 7: int ignored = |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3455 8: a + b; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3456 9: @} |
25829 | 3457 @end example |
3458 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3459 @ssindex topmost-intro |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3460 @ssindex topmost-intro-cont |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3461 @ssindex defun-open |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3462 @ssindex defun-close |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3463 @ssindex defun-block-intro |
25829 | 3464 Line 1 shows a @code{topmost-intro} since it is the first line that |
3465 introduces a top-level construct. Line 2 is a continuation of the | |
3466 top-level construct introduction so it has the syntax | |
3467 @code{topmost-intro-cont}. Line 3 shows a @code{defun-open} since it is | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3468 the brace that opens a top-level function definition. Line 9 is the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3469 corresponding |
25829 | 3470 @code{defun-close} since it contains the brace that closes the top-level |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
3471 function definition. Line 4 is a @code{defun-block-intro}, i.e., it is |
25829 | 3472 the first line of a brace-block, enclosed in a |
3473 top-level function definition. | |
3474 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3475 @ssindex statement |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3476 @ssindex statement-cont |
25829 | 3477 Lines 5, 6, and 7 are all given @code{statement} syntax since there |
3478 isn't much special about them. Note however that line 8 is given | |
3479 @code{statement-cont} syntax since it continues the statement begun | |
3480 on the previous line. | |
3481 | |
3482 Here's another example, which illustrates some C++ class syntactic | |
3483 symbols: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3484 |
25829 | 3485 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3486 1: class Bass |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3487 2: : public Guitar, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3488 3: public Amplifiable |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3489 4: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3490 5: public: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3491 6: Bass() |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3492 7: : eString( new BassString( 0.105 )), |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3493 8: aString( new BassString( 0.085 )), |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3494 9: dString( new BassString( 0.065 )), |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3495 10: gString( new BassString( 0.045 )) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3496 11: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3497 12: eString.tune( 'E' ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3498 13: aString.tune( 'A' ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3499 14: dString.tune( 'D' ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3500 15: gString.tune( 'G' ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3501 16: @} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3502 17: friend class Luthier; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3503 18: @}; |
25829 | 3504 @end example |
3505 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3506 @ssindex class-open |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3507 @ssindex class-close |
25829 | 3508 As in the previous example, line 1 has the @code{topmost-intro} syntax. |
3509 Here however, the brace that opens a C++ class definition on line 4 is | |
3510 assigned the @code{class-open} syntax. Note that in C++, classes, | |
3511 structs, and unions are essentially equivalent syntactically (and are | |
3512 very similar semantically), so replacing the @code{class} keyword in the | |
3513 example above with @code{struct} or @code{union} would still result in a | |
3514 syntax of @code{class-open} for line 4 @footnote{This is the case even | |
3515 for C and Objective-C. For consistency, structs in all supported | |
3516 languages are syntactically equivalent to classes. Note however that | |
3517 the keyword @code{class} is meaningless in C and Objective-C.}. | |
3518 Similarly, line 18 is assigned @code{class-close} syntax. | |
3519 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3520 @ssindex inher-intro |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3521 @ssindex inher-cont |
25829 | 3522 Line 2 introduces the inheritance list for the class so it is assigned |
3523 the @code{inher-intro} syntax, and line 3, which continues the | |
3524 inheritance list is given @code{inher-cont} syntax. | |
3525 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3526 @ssindex access-label |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3527 @ssindex inclass |
25829 | 3528 Hitting @kbd{C-c C-s} on line 5 shows the following analysis: |
3529 | |
3530 @example | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3531 ((inclass 58) (access-label 58)) |
25829 | 3532 @end example |
3533 | |
3534 @noindent | |
3535 The primary syntactic symbol for this line is @code{access-label} as | |
3536 this a label keyword that specifies access protection in C++. However, | |
3537 because this line is also a top-level construct inside a class | |
3538 definition, the analysis actually shows two syntactic symbols. The | |
3539 other syntactic symbol assigned to this line is @code{inclass}. | |
3540 Similarly, line 6 is given both @code{inclass} and @code{topmost-intro} | |
3541 syntax: | |
3542 | |
3543 @example | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3544 ((inclass 58) (topmost-intro 60)) |
25829 | 3545 @end example |
3546 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3547 @ssindex member-init-intro |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3548 @ssindex member-init-cont |
25829 | 3549 Line 7 introduces a C++ member initialization list and as such is given |
3550 @code{member-init-intro} syntax. Note that in this case it is | |
3551 @emph{not} assigned @code{inclass} since this is not considered a | |
3552 top-level construct. Lines 8 through 10 are all assigned | |
3553 @code{member-init-cont} since they continue the member initialization | |
3554 list started on line 7. | |
3555 | |
3556 @cindex in-class inline methods | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3557 @ssindex inline-open |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3558 @ssindex inline-close |
25829 | 3559 Line 11's analysis is a bit more complicated: |
3560 | |
3561 @example | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3562 ((inclass 58) (inline-open)) |
25829 | 3563 @end example |
3564 | |
3565 This line is assigned a syntax of both @code{inline-open} and | |
3566 @code{inclass} because it opens an @dfn{in-class} C++ inline method | |
3567 definition. This is distinct from, but related to, the C++ notion of an | |
3568 inline function in that its definition occurs inside an enclosing class | |
3569 definition, which in C++ implies that the function should be inlined. | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3570 However, if the definition of the @code{Bass} constructor appeared |
25829 | 3571 outside the class definition, the construct would be given the |
3572 @code{defun-open} syntax, even if the keyword @code{inline} appeared | |
3573 before the method name, as in: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3574 |
25829 | 3575 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3576 1: class Bass |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3577 2: : public Guitar, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3578 3: public Amplifiable |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3579 4: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3580 5: public: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3581 6: Bass(); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3582 7: @}; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3583 8: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3584 9: inline |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3585 10: Bass::Bass() |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3586 11: : eString( new BassString( 0.105 )), |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3587 12: aString( new BassString( 0.085 )), |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3588 13: dString( new BassString( 0.065 )), |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3589 14: gString( new BassString( 0.045 )) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3590 15: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3591 16: eString.tune( 'E' ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3592 17: aString.tune( 'A' ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3593 18: dString.tune( 'D' ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3594 19: gString.tune( 'G' ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3595 20: @} |
25829 | 3596 @end example |
3597 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3598 @ssindex friend |
25829 | 3599 Returning to the previous example, line 16 is given @code{inline-close} |
3600 syntax, while line 12 is given @code{defun-block-open} syntax, and lines | |
3601 13 through 15 are all given @code{statement} syntax. Line 17 is | |
3602 interesting in that its syntactic analysis list contains three | |
3603 elements: | |
3604 | |
3605 @example | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3606 ((inclass 58) (topmost-intro 380) (friend)) |
25829 | 3607 @end example |
3608 | |
3609 The @code{friend} syntactic symbol is a modifier that typically does not | |
3610 have a relative buffer position. | |
3611 | |
3612 Template definitions introduce yet another syntactic symbol: | |
3613 | |
3614 @example | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3615 1: ThingManager <int, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3616 2: Framework::Callback *, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3617 3: Mutex> framework_callbacks; |
25829 | 3618 @end example |
3619 | |
3620 Here, line 1 is analyzed as a @code{topmost-intro}, but lines 2 and 3 | |
3621 are both analyzed as @code{template-args-cont} lines. | |
3622 | |
3623 Here is another (totally contrived) example which illustrates how syntax | |
3624 is assigned to various conditional constructs: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3625 |
25829 | 3626 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3627 1: void spam( int index ) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3628 2: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3629 3: for( int i=0; i<index; i++ ) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3630 4: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3631 5: if( i == 10 ) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3632 6: do_something_special(); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3633 7: else |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3634 8: silly_label: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3635 9: do_something( i ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3636 10: @} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3637 11: do @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3638 12: another_thing( i-- ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3639 13: @} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3640 14: while( i > 0 ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3641 15: @} |
25829 | 3642 @end example |
3643 | |
3644 Only the lines that illustrate new syntactic symbols will be discussed. | |
3645 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3646 @ssindex substatement-open |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3647 @ssindex substatement-block-intro |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3648 @ssindex block-close |
25829 | 3649 Line 4 has a brace which opens a conditional's substatement block. It |
3650 is thus assigned @code{substatement-open} syntax, and since line 5 is | |
3651 the first line in the substatement block, it is assigned | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3652 @code{substatement-block-intro} syntax. Line 10 contains the brace that |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3653 closes the inner substatement block, and is therefore given the syntax |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3654 @code{block-close}. Line 13 is treated the same way. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3655 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3656 @ssindex substatement |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3657 Lines 6 and 9 are also substatements of conditionals, but since they |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3658 don't start blocks they are given @code{substatement} syntax |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3659 instead of @code{substatement-open}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3660 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3661 @ssindex substatement-label |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3662 Line 8 contains a label, which is normally given @code{label} syntax. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3663 This one is however a bit special since it's between a conditional and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3664 its substatement. It's analyzed as @code{substatement-label} to let you |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3665 handle this rather odd case differently from normal labels. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3666 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3667 @ssindex else-clause |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3668 @ssindex catch-clause |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3669 Line 7 start with an @code{else} that matches the @code{if} statement on |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3670 line 5. It is therefore given the @code{else-clause} syntax and is |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3671 anchored on the matching @code{if}. The @code{try}-@code{catch} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3672 constructs in C++ and Java are treated this way too, except that |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3673 @code{catch} and (in Java) @code{finally}, are marked with |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3674 @code{catch-clause}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3675 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3676 @ssindex do-while-closure |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3677 The @code{while} construct on line 14 that closes a @code{do} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3678 conditional is given the special syntax @code{do-while-closure} if it |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3679 appears on a line by itself. Note that if the @code{while} appeared on |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3680 the same line as the preceding close brace, that line would still have |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3681 @code{block-close} syntax. |
25829 | 3682 |
3683 Switch statements have their own set of syntactic symbols. Here's an | |
3684 example: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3685 |
25829 | 3686 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3687 1: void spam( enum Ingredient i ) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3688 2: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3689 3: switch( i ) @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3690 4: case Ham: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3691 5: be_a_pig(); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3692 6: break; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3693 7: case Salt: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3694 8: drink_some_water(); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3695 9: break; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3696 10: default: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3697 11: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3698 12: what_is_it(); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3699 13: break; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3700 14: @} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3701 15: @} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3702 14: @} |
25829 | 3703 @end example |
3704 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3705 @ssindex case-label |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3706 @ssindex statement-case-intro |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3707 @ssindex statement-case-open |
25829 | 3708 Here, lines 4, 7, and 10 are all assigned @code{case-label} syntax, |
3709 while lines 5 and 8 are assigned @code{statement-case-intro}. Line 11 | |
3710 is treated slightly differently since it contains a brace that opens a | |
3711 block --- it is given @code{statement-case-open} syntax. | |
3712 | |
3713 @cindex brace lists | |
3714 There are a set of syntactic symbols that are used to recognize | |
3715 constructs inside of brace lists. A brace list is defined as an | |
3716 @code{enum} or aggregate initializer list, such as might statically | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3717 initialize an array of structs. The three special aggregate constructs |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3718 in Pike, @code{(@{ @})}, @code{([ ])} and @code{(< >)}, are treated as |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3719 brace lists too. An example: |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3720 |
25829 | 3721 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3722 1: static char* ingredients[] = |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3723 2: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3724 3: "Ham", |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3725 4: "Salt", |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3726 5: NULL |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3727 6: @}; |
25829 | 3728 @end example |
3729 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3730 @ssindex brace-list-open |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3731 @ssindex brace-list-intro |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3732 @ssindex brace-list-close |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3733 @ssindex brace-list-entry |
25829 | 3734 Following convention, line 2 in this example is assigned |
3735 @code{brace-list-open} syntax, and line 3 is assigned | |
3736 @code{brace-list-intro} syntax. Likewise, line 6 is assigned | |
3737 @code{brace-list-close} syntax. Lines 4 and 5 however, are assigned | |
3738 @code{brace-list-entry} syntax, as would all subsequent lines in this | |
3739 initializer list. | |
3740 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3741 @ssindex brace-entry-open |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3742 Your static initializer might be initializing nested structures, for |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3743 example: |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3744 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3745 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3746 1: struct intpairs[] = |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3747 2: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3748 3: @{ 1, 2 @}, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3749 4: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3750 5: 3, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3751 6: 4 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3752 7: @} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3753 8: @{ 1, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3754 9: 2 @}, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3755 10: @{ 3, 4 @} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3756 11: @}; |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3757 @end example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3758 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3759 Here, you've already seen the analysis of lines 1, 2, 3, and 11. On |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3760 line 4, things get interesting; this line is assigned |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3761 @code{brace-entry-open} syntactic symbol because it's a bracelist entry |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3762 line that starts with an open brace. Lines 5 and 6 (and line 9) are |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3763 pretty standard, and line 7 is a @code{brace-list-close} as you'd |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3764 expect. Once again, line 8 is assigned as @code{brace-entry-open} as is |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3765 line 10. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
3766 |
25829 | 3767 External language definition blocks also have their own syntactic |
3768 symbols. In this example: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3769 |
25829 | 3770 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3771 1: extern "C" |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3772 2: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3773 3: int thing_one( int ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3774 4: int thing_two( double ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3775 5: @} |
25829 | 3776 @end example |
3777 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3778 @ssindex extern-lang-open |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3779 @ssindex extern-lang-close |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3780 @ssindex inextern-lang |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3781 @ssindex inclass |
25829 | 3782 @noindent |
3783 line 2 is given the @code{extern-lang-open} syntax, while line 5 is given | |
3784 the @code{extern-lang-close} syntax. The analysis for line 3 yields: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3785 |
25829 | 3786 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3787 ((inextern-lang) (topmost-intro 14)) |
25829 | 3788 @end example |
3789 | |
3790 @noindent | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3791 where @code{inextern-lang} is a modifier similar in purpose to |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3792 @code{inclass}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3793 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3794 There are various other top level blocks like @code{extern}, and they |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3795 are all treated in the same way except that the symbols are named after |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
3796 the keyword that introduces the block. e.g., C++ namespace blocks get |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3797 the three symbols @code{namespace-open}, @code{namespace-close} and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3798 @code{innamespace}. The currently recognized top level blocks are: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3799 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3800 @table @asis |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3801 @item @code{extern-lang-open}, @code{extern-lang-close}, @code{inextern-lang} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3802 @code{extern} blocks in C and C++.@footnote{These should logically be |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3803 named @code{extern-open}, @code{extern-close} and @code{inextern}, but |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3804 that isn't the case for historical reasons.} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3805 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3806 @item @code{namespace-open}, @code{namespace-close}, @code{innamespace} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3807 @ssindex namespace-open |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3808 @ssindex namespace-close |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3809 @ssindex innamespace |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3810 @code{namespace} blocks in C++. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3811 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3812 @item @code{module-open}, @code{module-close}, @code{inmodule} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3813 @ssindex module-open |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3814 @ssindex module-close |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3815 @ssindex inmodule |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3816 @code{module} blocks in CORBA IDL. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3817 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3818 @item @code{composition-open}, @code{composition-close}, @code{incomposition} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3819 @ssindex composition-open |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3820 @ssindex composition-close |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3821 @ssindex incomposition |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3822 @code{composition} blocks in CORBA CIDL. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3823 @end table |
25829 | 3824 |
3825 A number of syntactic symbols are associated with parenthesis lists, | |
3826 a.k.a argument lists, as found in function declarations and function | |
3827 calls. This example illustrates these: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3828 |
25829 | 3829 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3830 1: void a_function( int line1, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3831 2: int line2 ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3832 3: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3833 4: void a_longer_function( |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3834 5: int line1, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3835 6: int line2 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3836 7: ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3837 8: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3838 9: void call_them( int line1, int line2 ) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3839 10: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3840 11: a_function( |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3841 12: line1, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3842 13: line2 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3843 14: ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3844 15: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3845 16: a_longer_function( line1, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3846 17: line2 ); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3847 18: @} |
25829 | 3848 @end example |
3849 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3850 @ssindex arglist-intro |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3851 @ssindex arglist-close |
25829 | 3852 Lines 5 and 12 are assigned @code{arglist-intro} syntax since they are |
3853 the first line following the open parenthesis, and lines 7 and 14 are | |
3854 assigned @code{arglist-close} syntax since they contain the parenthesis | |
3855 that closes the argument list. | |
3856 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3857 @ssindex arglist-cont-nonempty |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3858 @ssindex arglist-cont |
25829 | 3859 Lines that continue argument lists can be assigned one of two syntactic |
3860 symbols. For example, Lines 2 and 17 | |
3861 are assigned @code{arglist-cont-nonempty} syntax. What this means | |
3862 is that they continue an argument list, but that the line containing the | |
3863 parenthesis that opens the list is @emph{not empty} following the open | |
3864 parenthesis. Contrast this against lines 6 and 13 which are assigned | |
3865 @code{arglist-cont} syntax. This is because the parenthesis that opens | |
3866 their argument lists is the last character on that line. | |
3867 | |
3868 Note that there is no @code{arglist-open} syntax. This is because any | |
3869 parenthesis that opens an argument list, appearing on a separate line, | |
3870 is assigned the @code{statement-cont} syntax instead. | |
3871 | |
3872 A few miscellaneous syntactic symbols that haven't been previously | |
3873 covered are illustrated by this C++ example: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3874 |
25829 | 3875 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3876 1: void Bass::play( int volume ) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3877 2: const |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3878 3: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3879 4: /* this line starts a multiline |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3880 5: * comment. This line should get `c' syntax */ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3881 6: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3882 7: char* a_multiline_string = "This line starts a multiline \ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3883 8: string. This line should get `string' syntax."; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3884 9: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3885 10: note: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3886 11: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3887 12: #ifdef LOCK |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3888 13: Lock acquire(); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3889 14: #endif // LOCK |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3890 15: slap_pop(); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3891 16: cout << "I played " |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3892 17: << "a note\n"; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3893 18: @} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3894 19: @} |
25829 | 3895 @end example |
3896 | |
3897 The lines to note in this example include: | |
3898 | |
3899 @itemize @bullet | |
3900 @item | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3901 @ssindex func-decl-cont |
30396
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
3902 Line 2 is assigned the @code{func-decl-cont} syntax. |
25829 | 3903 |
3904 @item | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3905 @ssindex comment-intro |
30396
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
3906 Line 4 is assigned both @code{defun-block-intro} @emph{and} |
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
3907 @code{comment-intro} syntax. |
25829 | 3908 |
3909 @item | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3910 @ssindex c |
30396
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
3911 Line 5 is assigned @code{c} syntax. |
25829 | 3912 |
3913 @item | |
3914 @cindex syntactic whitespace | |
30396
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
3915 Line 6 which, even though it contains nothing but whitespace, is |
25829 | 3916 assigned @code{defun-block-intro}. Note that the appearance of the |
3917 comment on lines 4 and 5 do not cause line 6 to be assigned | |
3918 @code{statement} syntax because comments are considered to be | |
3919 @dfn{syntactic whitespace}, which are ignored when analyzing | |
30396
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
3920 code. |
25829 | 3921 |
3922 @item | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3923 @ssindex string |
30396
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
3924 Line 8 is assigned @code{string} syntax. |
25829 | 3925 |
3926 @item | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3927 @ssindex label |
30396
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
3928 Line 10 is assigned @code{label} syntax. |
25829 | 3929 |
3930 @item | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3931 @ssindex block-open |
30396
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
3932 Line 11 is assigned @code{block-open} syntax. |
25829 | 3933 |
3934 @item | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3935 @ssindex cpp-macro |
30396
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
3936 Lines 12 and 14 are assigned @code{cpp-macro} syntax in addition to the |
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
3937 normal syntactic symbols (@code{statement-block-intro} and |
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
3938 @code{statement}, respectively). Normally @code{cpp-macro} is |
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
3939 configured to cancel out the normal syntactic context to make all |
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
3940 preprocessor directives stick to the first column, but that's easily |
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
3941 changed if you want preprocessor directives to be indented like the rest |
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
3942 of the code. |
25829 | 3943 |
3944 @item | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3945 @ssindex stream-op |
30396
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
3946 Line 17 is assigned @code{stream-op} syntax. |
25829 | 3947 @end itemize |
3948 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3949 @cindex multiline macros |
25829 | 3950 @cindex syntactic whitespace |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3951 @ssindex cpp-define-intro |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3952 Multiline preprocessor macro definitions are normally handled just like |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
3953 other code, i.e., the lines inside them are indented according to the |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3954 syntactic analysis of the preceding lines inside the macro. The first |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
3955 line inside a macro definition (i.e., the line after the starting line of |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3956 the cpp directive itself) gets @code{cpp-define-intro}. In this example: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3957 |
25829 | 3958 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3959 1: #define LIST_LOOP(cons, listp) \ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3960 2: for (cons = listp; !NILP (cons); cons = XCDR (cons)) \ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3961 3: if (!CONSP (cons)) \ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3962 4: signal_error ("Invalid list format", listp); \ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3963 5: else |
25829 | 3964 @end example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3965 |
25829 | 3966 @noindent |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3967 line 1 is given the syntactic symbol @code{cpp-macro}. The first line |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3968 of a cpp directive is always given that symbol. Line 2 is given |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3969 @code{cpp-define-intro}, so that you can give the macro body as a whole |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3970 some extra indentation. Lines 3 through 5 are then analyzed as normal |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
3971 code, i.e., @code{substatement} on lines 3 and 4, and @code{else-clause} |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3972 on line 5. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3973 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3974 The syntactic analysis inside macros can be turned off with |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3975 @code{c-syntactic-indentation-in-macros}. In that case, lines 2 through |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3976 5 would all be given @code{cpp-macro-cont} with a relative buffer |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3977 position pointing to the @code{#} which starts the cpp |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3978 directive@footnote{This is how @ccmode{} 5.28 and earlier analyzed |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3979 macros.}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3980 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3981 @xref{Macro Handling}, for more info about the treatment of macros. |
25829 | 3982 |
3983 In Objective-C buffers, there are three additional syntactic symbols | |
3984 assigned to various message calling constructs. Here's an example | |
3985 illustrating these: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3986 |
25829 | 3987 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3988 1: - (void)setDelegate:anObject |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3989 2: withStuff:stuff |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3990 3: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3991 4: [delegate masterWillRebind:self |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3992 5: toDelegate:anObject |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3993 6: withExtraStuff:stuff]; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3994 7: @} |
25829 | 3995 @end example |
3996 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3997 @ssindex objc-method-intro |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3998 @ssindex objc-method-args-cont |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
3999 @ssindex objc-method-call-cont |
25829 | 4000 Here, line 1 is assigned @code{objc-method-intro} syntax, and line 2 is |
4001 assigned @code{objc-method-args-cont} syntax. Lines 5 and 6 are both | |
4002 assigned @code{objc-method-call-cont} syntax. | |
4003 | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4004 Java has a concept of anonymous classes, which may look something like |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4005 this: |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4006 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4007 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4008 1: public void watch(Observable o) @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4009 2: o.addObserver(new Observer() @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4010 3: public void update(Observable o, Object arg) @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4011 4: history.addElement(arg); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4012 5: @} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4013 6: @}); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4014 7: @} |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4015 @end example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4016 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4017 @ssindex inexpr-class |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4018 The brace following the @code{new} operator opens the anonymous class. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4019 Lines 3 and 6 are assigned the @code{inexpr-class} syntax, besides the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4020 @code{inclass} symbol used in normal classes. Thus, the class will be |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4021 indented just like a normal class, with the added indentation given to |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4022 @code{inexpr-class}. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4023 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4024 There are a few occasions where a statement block may be used inside an |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4025 expression. One is in C code using the gcc extension for this, e.g: |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4026 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4027 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4028 1: int res = (@{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4029 2: int y = foo (); int z; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4030 3: if (y > 0) z = y; else z = - y; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4031 4: z; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4032 5: @}); |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4033 @end example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4034 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4035 @ssindex inexpr-statement |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4036 Lines 2 and 5 get the @code{inexpr-statement} syntax, besides the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4037 symbols they'd get in a normal block. Therefore, the indentation put on |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4038 @code{inexpr-statement} is added to the normal statement block |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4039 indentation. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4040 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4041 In Pike code, there are a few other situations where blocks occur inside |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4042 statements, as illustrated here: |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4043 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4044 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4045 1: array itgob() |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4046 2: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4047 3: string s = map (backtrace()[-2][3..], |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4048 4: lambda |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4049 5: (mixed arg) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4050 6: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4051 7: return sprintf ("%t", arg); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4052 8: @}) * ", " + "\n"; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4053 9: return catch @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4054 10: write (s + "\n"); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4055 11: @}; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4056 12: @} |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4057 @end example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4058 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4059 @ssindex inlambda |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4060 @ssindex lambda-intro-cont |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4061 Lines 4 through 8 contain a lambda function, which @ccmode{} recognizes |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4062 by the @code{lambda} keyword. If the function argument list is put |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4063 on a line of its own, as in line 5, it gets the @code{lambda-intro-cont} |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4064 syntax. The function body is handled as an inline method body, with the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4065 addition of the @code{inlambda} syntactic symbol. This means that line |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4066 6 gets @code{inlambda} and @code{inline-open}, and line 8 gets |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4067 @code{inline-close}@footnote{You might wonder why it doesn't get |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4068 @code{inlambda} too. It's because the closing brace is relative to the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4069 opening brace, which stands on its own line in this example. If the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4070 opening brace was hanging on the previous line, then the closing brace |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4071 would get the @code{inlambda} syntax too to be indented correctly.}. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4072 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4073 @ssindex inexpr-statement |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4074 On line 9, @code{catch} is a special function taking a statement block |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4075 as its argument. The block is handled as an in-expression statement |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4076 with the @code{inexpr-statement} syntax, just like the gcc extended C |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4077 example above. The other similar special function, @code{gauge}, is |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4078 handled like this too. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4079 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4080 @ssindex knr-argdecl-intro |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4081 @ssindex knr-argdecl |
25829 | 4082 Two other syntactic symbols can appear in old style, non-prototyped C |
4083 code @footnote{a.k.a. K&R C, or Kernighan & Ritchie C}: | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4084 |
25829 | 4085 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4086 1: int add_three_integers(a, b, c) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4087 2: int a; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4088 3: int b; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4089 4: int c; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4090 5: @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4091 6: return a + b + c; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4092 7: @} |
25829 | 4093 @end example |
4094 | |
4095 Here, line 2 is the first line in an argument declaration list and so is | |
4096 given the @code{knr-argdecl-intro} syntactic symbol. Subsequent lines | |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
4097 (i.e., lines 3 and 4 in this example), are given @code{knr-argdecl} |
25829 | 4098 syntax. |
4099 | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4100 |
25829 | 4101 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4102 @node Indentation Functions, AWK Mode, Syntactic Symbols, Top |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4103 @comment node-name, next, previous, up |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4104 @chapter Indentation Functions |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4105 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4106 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4107 @cindex indentation function |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4108 @cindex line-up function |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4109 Often there are cases when a simple offset setting on a syntactic |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4110 symbol isn't enough to get the desired indentation. Therefore, it's |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4111 also possible to use an @dfn{indentation function} (a.k.a. @dfn{line-up |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4112 function}) for a syntactic symbol. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4113 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4114 @ccmode{} comes with many predefined indentation functions for common |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4115 situations. If none of these does what you want, you can write your |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4116 own, see @ref{Custom Indentation Functions}. If you do, it's probably a |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4117 good idea to start working from one of these predefined functions, they |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4118 can be found in the file @file{cc-align.el}. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4119 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4120 For every function below there is a ``works with'' list that indicates |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4121 which syntactic symbols the function is intended to be used with. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4122 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4123 @macro workswith |
36923 | 4124 @emph{Works with:@ } |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4125 @end macro |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4126 @ifinfo |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4127 @unmacro workswith |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4128 @macro workswith |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4129 Works with: |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4130 @end macro |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4131 @end ifinfo |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4132 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4133 @macro sssTBasicOffset |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4134 <--> @i{c-basic-offset}@c |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4135 @end macro |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4136 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4137 @macro sssTsssTBasicOffset |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4138 <--><--> @i{c-basic-offset}@c |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4139 @end macro |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4140 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4141 @macro hereFn{func} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4142 <- @i{\func\}@c |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4143 @end macro |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4144 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4145 @c The TeX backend seems to insert extra spaces around the argument. :P |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4146 @iftex |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4147 @unmacro hereFn |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4148 @macro hereFn{func} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4149 <-@i{\func\}@c |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4150 @end macro |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4151 @end iftex |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4152 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4153 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4154 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4155 @defun c-indent-one-line-block |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4156 @findex indent-one-line-block (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4157 Indent a one line block @code{c-basic-offset} extra. E.g: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4158 |
30396
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
4159 @example |
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
4160 @group |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4161 if (n > 0) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4162 @{m+=n; n=0;@} @hereFn{c-indent-one-line-block} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4163 @sssTBasicOffset{} |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4164 @end group |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4165 @end example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4166 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4167 @noindent |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4168 and |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4169 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4170 @example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4171 @group |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4172 if (n > 0) |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4173 @{ @hereFn{c-indent-one-line-block} |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4174 m+=n; n=0; |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4175 @} |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4176 @end group |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4177 @end example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4178 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4179 The block may be surrounded by any kind of parenthesis characters. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4180 @code{nil} is returned if the line doesn't start with a one line block, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4181 which makes the function usable in list expressions. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4182 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4183 @workswith Almost all syntactic symbols, but most useful on the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4184 @code{-open} symbols. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4185 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4186 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4187 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4188 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4189 @defun c-indent-multi-line-block |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4190 @findex indent-multi-line-block (c-) |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4191 Indent a multiline block @code{c-basic-offset} extra. E.g: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4192 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4193 @example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4194 @group |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4195 int *foo[] = @{ |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4196 NULL, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4197 @{17@}, @hereFn{c-indent-multi-line-block} |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4198 @end group |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4199 @end example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4200 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4201 @noindent |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4202 and |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4203 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4204 @example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4205 @group |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4206 int *foo[] = @{ |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4207 NULL, |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4208 @{ @hereFn{c-indent-multi-line-block} |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4209 17 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4210 @}, |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4211 @sssTBasicOffset{} |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4212 @end group |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4213 @end example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4214 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4215 The block may be surrounded by any kind of parenthesis characters. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4216 @code{nil} is returned if the line doesn't start with a multiline |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4217 block, which makes the function usable in list expressions. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4218 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4219 @workswith Almost all syntactic symbols, but most useful on the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4220 @code{-open} symbols. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4221 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4222 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4223 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4224 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4225 @defun c-lineup-argcont |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4226 @findex lineup-argcont (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4227 Line up a continued argument. E.g: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4228 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4229 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4230 @group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4231 foo (xyz, aaa + bbb + ccc |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4232 + ddd + eee + fff); @hereFn{c-lineup-argcont} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4233 @end group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4234 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4235 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4236 Only continuation lines like this are touched, @code{nil} is returned on |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4237 lines which are the start of an argument. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4238 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4239 Within a gcc @code{asm} block, @code{:} is recognised as an argument |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4240 separator, but of course only between operand specifications, not in the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4241 expressions for the operands. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4242 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4243 @workswith @code{arglist-cont}, @code{arglist-cont-nonempty}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4244 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4245 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4246 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4247 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4248 @defun c-lineup-arglist |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4249 @findex lineup-arglist (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4250 Line up the current argument line under the first argument. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4251 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4252 As a special case, if an argument on the same line as the open |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4253 parenthesis starts with a brace block opener, the indentation is |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4254 @code{c-basic-offset} only. This is intended as a ``DWIM'' measure in |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4255 cases like macros that contains statement blocks, e.g: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4256 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4257 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4258 @group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4259 A_VERY_LONG_MACRO_NAME (@{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4260 some (code, with + long, lines * in[it]); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4261 @}); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4262 @sssTBasicOffset{} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4263 @end group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4264 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4265 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4266 This is motivated partly because it's more in line with how code |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4267 blocks are handled, and partly since it approximates the behavior of |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4268 earlier CC Mode versions, which due to inaccurate analysis tended to |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4269 indent such cases this way. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4270 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4271 @workswith @code{arglist-cont-nonempty}, @code{arglist-close}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4272 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4273 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4274 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4275 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4276 @defun c-lineup-arglist-intro-after-paren |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4277 @findex lineup-arglist-intro-after-paren (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4278 Line up a line to just after the open paren of the surrounding paren or |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4279 brace block. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4280 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4281 @workswith @code{defun-block-intro}, @code{brace-list-intro}, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4282 @code{statement-block-intro}, @code{statement-case-intro}, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4283 @code{arglist-intro}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4284 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4285 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4286 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4287 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4288 @defun c-lineup-arglist-close-under-paren |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4289 @findex lineup-arglist-close-under-paren (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4290 Set your @code{arglist-close} syntactic symbol to this line-up function |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4291 so that parentheses that close argument lists will line up under the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4292 parenthesis that opened the argument list. It can also be used with |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4293 @code{arglist-cont} and @code{arglist-cont-nonempty} to line up all |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4294 lines inside a parenthesis under the open paren. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4295 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4296 As a special case, if a brace block is opened at the same line as the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4297 open parenthesis of the argument list, the indentation is |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4298 @code{c-basic-offset} only. See @code{c-lineup-arglist} for further |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4299 discussion of this ``DWIM'' measure. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4300 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4301 @workswith Almost all symbols, but are typically most useful on |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4302 @code{arglist-close}, @code{brace-list-close}, @code{arglist-cont} and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4303 @code{arglist-cont-nonempty}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4304 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4305 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4306 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4307 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4308 @defun c-lineup-arglist-operators |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4309 @findex lineup-arglist-operators (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4310 Line up lines starting with an infix operator under the open paren. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4311 Return @code{nil} on lines that don't start with an operator, to leave |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4312 those cases to other lineup functions. Example: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4313 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4314 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4315 @group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4316 if ( x < 10 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4317 || at_limit (x, @hereFn{c-lineup-arglist-operators} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4318 list) @hereFn{c-lineup-arglist-operators@r{ returns nil}} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4319 ) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4320 @end group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4321 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4322 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4323 Since this function doesn't do anything for lines without an infix |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4324 operator you typically want to use it together with some other lineup |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
4325 settings, e.g., as follows (the @code{arglist-close} setting is just a |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4326 suggestion to get a consistent style): |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4327 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4328 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4329 (c-set-offset 'arglist-cont |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4330 '(c-lineup-arglist-operators 0)) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4331 (c-set-offset 'arglist-cont-nonempty |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4332 '(c-lineup-arglist-operators c-lineup-arglist)) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4333 (c-set-offset 'arglist-close |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4334 '(c-lineup-arglist-close-under-paren)) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4335 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4336 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4337 @workswith @code{arglist-cont}, @code{arglist-cont-nonempty}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4338 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4339 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4340 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4341 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4342 @defun c-lineup-C-comments |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4343 @findex lineup-C-comments (c-) |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4344 Line up C block comment continuation lines. Various heuristics are used |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4345 to handle most of the common comment styles. Some examples: |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4346 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4347 @example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4348 @group |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4349 /* /** /* |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4350 * text * text text |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4351 */ */ */ |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4352 @end group |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4353 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4354 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4355 @example |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4356 @group |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4357 /* text /* /** |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4358 text ** text ** text |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4359 */ */ */ |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4360 @end group |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4361 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4362 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4363 @example |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4364 @group |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4365 /************************************************** |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4366 * text |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4367 *************************************************/ |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4368 @end group |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4369 @end example |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4370 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4371 @vindex comment-start-skip |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4372 @example |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4373 @group |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4374 /************************************************** |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4375 Free form text comments: |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4376 In comments with a long delimiter line at the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4377 start, the indentation is kept unchanged for lines |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4378 that start with an empty comment line prefix. The |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4379 delimiter line is whatever matches the |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4380 @code{comment-start-skip} regexp. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4381 **************************************************/ |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4382 @end group |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4383 @end example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4384 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4385 The style variable @code{c-comment-prefix-regexp} is used to recognize |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
4386 the comment line prefix, e.g., the @samp{*} that usually starts every |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4387 line inside a comment. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4388 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4389 @workswith The @code{c} syntactic symbol. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4390 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4391 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4392 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4393 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4394 @defun c-lineup-cascaded-calls |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4395 @findex lineup-cascaded-calls (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4396 Line up ``cascaded calls'' under each other. If the line begins with |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4397 @code{->} or @code{.} and the preceding line ends with one or more |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4398 function calls preceded by the same token, then the arrow is lined up |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4399 with the first of those tokens. E.g: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4400 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4401 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4402 @group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4403 r = proc->add(17)->add(18) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4404 ->add(19) + @hereFn{c-lineup-cascaded-calls} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4405 offset; @hereFn{c-lineup-cascaded-calls@r{ (inactive)}} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4406 @end group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4407 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4408 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4409 In any other situation @code{nil} is returned to allow use in list |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4410 expressions. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4411 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4412 @workswith @code{topmost-intro-cont}, @code{statement-cont}, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4413 @code{arglist-cont}, @code{arglist-cont-nonempty}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4414 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4415 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4416 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4417 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4418 @defun c-lineup-close-paren |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4419 @findex lineup-close-paren (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4420 Line up the closing paren under its corresponding open paren if the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4421 open paren is followed by code. If the open paren ends its line, no |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4422 indentation is added. E.g: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4423 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4424 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4425 @group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4426 main (int, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4427 char ** |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4428 ) @hereFn{c-lineup-close-paren} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4429 @end group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4430 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4431 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4432 @noindent |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4433 and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4434 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4435 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4436 @group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4437 main ( |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4438 int, char ** |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4439 ) @hereFn{c-lineup-close-paren} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4440 @end group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4441 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4442 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4443 As a special case, if a brace block is opened at the same line as the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4444 open parenthesis of the argument list, the indentation is |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4445 @code{c-basic-offset} instead of the open paren column. See |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4446 @code{c-lineup-arglist} for further discussion of this ``DWIM'' measure. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4447 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4448 @workswith All @code{*-close} symbols. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4449 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4450 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4451 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4452 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4453 @defun c-lineup-comment |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4454 @findex lineup-comment (c-) |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4455 Line up a comment-only line according to the style variable |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4456 @code{c-comment-only-line-offset}. If the comment is lined up with a |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4457 comment starter on the previous line, that alignment is preserved. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4458 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4459 @defopt c-comment-only-line-offset |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4460 @vindex comment-only-line-offset (c-) |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4461 This style variable specifies the extra offset for the line. It can |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4462 contain an integer or a cons cell of the form |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4463 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4464 @example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4465 (@r{@var{non-anchored-offset}} . @r{@var{anchored-offset}}) |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4466 @end example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4467 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4468 @noindent |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4469 where @var{non-anchored-offset} is the amount of offset given to |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4470 non-column-zero anchored lines, and @var{anchored-offset} is the amount |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4471 of offset to give column-zero anchored lines. Just an integer as value |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4472 is equivalent to @code{(@r{@var{value}} . -1000)}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4473 @end defopt |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4474 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4475 @workswith @code{comment-intro}. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4476 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4477 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4478 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4479 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4480 @defun c-lineup-cpp-define |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4481 @findex lineup-cpp-define (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4482 Line up macro continuation lines according to the indentation of the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4483 construct preceding the macro. E.g: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4484 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4485 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4486 @group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4487 const char msg[] = @hereFn{@r{The beginning of the preceding construct.}} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4488 \"Some text.\"; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4489 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4490 #define X(A, B) \ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4491 do @{ \ @hereFn{c-lineup-cpp-define} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4492 printf (A, B); \ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4493 @} while (0) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4494 @end group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4495 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4496 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4497 @noindent |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4498 and: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4499 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4500 @example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4501 @group |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4502 int dribble() @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4503 if (!running) @hereFn{@r{The beginning of the preceding construct.}} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4504 error(\"Not running!\"); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4505 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4506 #define X(A, B) \ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4507 do @{ \ @hereFn{c-lineup-cpp-define} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4508 printf (A, B); \ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4509 @} while (0) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4510 @end group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4511 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4512 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4513 If @code{c-syntactic-indentation-in-macros} is non-@code{nil}, the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4514 function returns the relative indentation to the macro start line to |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
4515 allow accumulation with other offsets. e.g., in the following cases, |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4516 @code{cpp-define-intro} is combined with the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4517 @code{statement-block-intro} that comes from the @samp{do @{} that hangs |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4518 on the @samp{#define} line: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4519 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4520 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4521 @group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4522 const char msg[] = |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4523 \"Some text.\"; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4524 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4525 #define X(A, B) do @{ \ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4526 printf (A, B); \ @hereFn{c-lineup-cpp-define} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4527 this->refs++; \ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4528 @} while (0) @hereFn{c-lineup-cpp-define} |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4529 @end group |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4530 @end example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4531 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4532 @noindent |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4533 and: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4534 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4535 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4536 @group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4537 int dribble() @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4538 if (!running) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4539 error(\"Not running!\"); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4540 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4541 #define X(A, B) do @{ \ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4542 printf (A, B); \ @hereFn{c-lineup-cpp-define} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4543 this->refs++; \ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4544 @} while (0) @hereFn{c-lineup-cpp-define} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4545 @end group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4546 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4547 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4548 The relative indentation returned by @code{c-lineup-cpp-define} is zero |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4549 and two, respectively, on the two lines in each of these examples. They |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4550 are then added to the two column indentation that |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4551 @code{statement-block-intro} gives in both cases here. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4552 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4553 If the relative indentation is zero, then @code{nil} is returned |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4554 instead. That is useful in a list expression to specify the default |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4555 indentation on the top level. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4556 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4557 If @code{c-syntactic-indentation-in-macros} is @code{nil} then this |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4558 function keeps the current indentation, except for empty lines (ignoring |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4559 the ending backslash) where it takes the indentation from the closest |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4560 preceding nonempty line in the macro. If there's no such line in the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4561 macro then the indentation is taken from the construct preceding it, as |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4562 described above. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4563 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4564 @workswith @code{cpp-define-intro}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4565 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4566 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4567 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4568 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4569 @defun c-lineup-dont-change |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4570 @findex lineup-dont-change (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4571 This lineup function makes the line stay at whatever indentation it |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4572 already has; think of it as an identity function for lineups. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4573 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4574 @workswith Any syntactic symbol. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4575 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4576 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4577 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4578 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4579 @defun c-lineup-gcc-asm-reg |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4580 @findex lineup-gcc-asm-reg (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4581 Line up a gcc asm register under one on a previous line. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4582 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4583 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4584 @group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4585 asm ("foo %1, %0\n" |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4586 "bar %0, %1" |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4587 : "=r" (w), |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4588 "=r" (x) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4589 : "0" (y), |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4590 "1" (z)); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4591 @end group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4592 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4593 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4594 The @samp{x} line is aligned to the text after the @samp{:} on the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4595 @samp{w} line, and similarly @samp{z} under @samp{y}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4596 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4597 This is done only in an @samp{asm} or @samp{__asm__} block, and only to |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4598 those lines mentioned. Anywhere else @code{nil} is returned. The usual |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4599 arrangement is to have this routine as an extra feature at the start of |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4600 arglist lineups, e.g. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4601 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4602 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4603 (c-lineup-gcc-asm-reg c-lineup-arglist) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4604 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4605 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4606 @workswith @code{arglist-cont}, @code{arglist-cont-nonempty}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4607 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4608 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4609 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4610 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4611 @defun c-lineup-inexpr-block |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4612 @findex lineup-inexpr-block (c-) |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4613 This can be used with the in-expression block symbols to indent the |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
4614 whole block to the column where the construct is started. e.g., for Java |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4615 anonymous classes, this lines up the class under the @samp{new} keyword, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4616 and in Pike it lines up the lambda function body under the @samp{lambda} |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4617 keyword. Returns @code{nil} if the block isn't part of such a |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4618 construct. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4619 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4620 @workswith @code{inlambda}, @code{inexpr-statement}, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4621 @code{inexpr-class}. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4622 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4623 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4624 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4625 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4626 @defun c-lineup-java-inher |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4627 @findex lineup-java-inher (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4628 Line up Java implements and extends declarations. If class names |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4629 follow on the same line as the @samp{implements}/@samp{extends} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4630 keyword, they are lined up under each other. Otherwise, they are |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4631 indented by adding @code{c-basic-offset} to the column of the keyword. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4632 E.g: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4633 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4634 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4635 @group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4636 class Foo |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4637 extends |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4638 Bar @hereFn{c-lineup-java-inher} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4639 @sssTBasicOffset{} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4640 @end group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4641 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4642 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4643 @noindent |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4644 and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4645 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4646 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4647 @group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4648 class Foo |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4649 extends Cyphr, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4650 Bar @hereFn{c-lineup-java-inher} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4651 @end group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4652 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4653 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4654 @workswith @code{inher-cont}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4655 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4656 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4657 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4658 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4659 @defun c-lineup-java-throws |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4660 @findex lineup-java-throws (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4661 Line up Java throws declarations. If exception names follow on the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4662 same line as the throws keyword, they are lined up under each other. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4663 Otherwise, they are indented by adding @code{c-basic-offset} to the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4664 column of the @samp{throws} keyword. The @samp{throws} keyword itself |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4665 is also indented by @code{c-basic-offset} from the function declaration |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4666 start if it doesn't hang. E.g: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4667 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4668 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4669 @group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4670 int foo() |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4671 throws @hereFn{c-lineup-java-throws} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4672 Bar @hereFn{c-lineup-java-throws} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4673 @sssTsssTBasicOffset{} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4674 @end group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4675 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4676 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4677 @noindent |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4678 and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4679 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4680 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4681 @group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4682 int foo() throws Cyphr, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4683 Bar, @hereFn{c-lineup-java-throws} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4684 Vlod @hereFn{c-lineup-java-throws} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4685 @end group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4686 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4687 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4688 @workswith @code{func-decl-cont}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4689 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4690 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4691 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4692 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4693 @defun c-lineup-knr-region-comment |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4694 @findex lineup-knr-region-comment (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4695 Line up a comment in the ``K&R region'' with the declaration. That is |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4696 the region between the function or class header and the beginning of the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4697 block. E.g: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4698 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4699 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4700 @group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4701 int main() |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4702 /* Called at startup. */ @hereFn{c-lineup-knr-region-comment} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4703 @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4704 return 0; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4705 @} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4706 @end group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4707 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4708 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4709 Return @code{nil} if called in any other situation, to be useful in list |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4710 expressions. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4711 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4712 @workswith @code{comment-intro}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4713 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4714 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4715 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4716 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4717 @defun c-lineup-math |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4718 @findex lineup-math (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4719 Line up the current line to after the equal sign on the first line in the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4720 statement. If there isn't any, indent with @code{c-basic-offset}. If |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4721 the current line contains an equal sign too, try to align it with the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4722 first one. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4723 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4724 @workswith @code{topmost-intro-cont}, @code{statement-cont}, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4725 @code{arglist-cont}, @code{arglist-cont-nonempty}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4726 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4727 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4728 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4729 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4730 @defun c-lineup-multi-inher |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4731 @findex lineup-multi-inher (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4732 Line up the classes in C++ multiple inheritance clauses and member |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4733 initializers under each other. E.g: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4734 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4735 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4736 @group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4737 Foo::Foo (int a, int b): |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4738 Cyphr (a), |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4739 Bar (b) @hereFn{c-lineup-multi-inher} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4740 @end group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4741 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4742 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4743 @noindent |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4744 and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4745 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4746 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4747 @group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4748 class Foo |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4749 : public Cyphr, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4750 public Bar @hereFn{c-lineup-multi-inher} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4751 @end group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4752 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4753 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4754 @noindent |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4755 and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4756 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4757 @example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4758 @group |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4759 Foo::Foo (int a, int b) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4760 : Cyphr (a) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4761 , Bar (b) @hereFn{c-lineup-multi-inher} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4762 @end group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4763 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4764 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4765 @workswith @code{inher-cont}, @code{member-init-cont}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4766 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4767 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4768 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4769 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4770 @defun c-lineup-ObjC-method-call |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4771 @findex lineup-ObjC-method-call (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4772 For Objective-C code, line up selector args as Emacs Lisp mode does |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4773 with function args: go to the position right after the message receiver, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4774 and if you are at the end of the line, indent the current line |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4775 c-basic-offset columns from the opening bracket; otherwise you are |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4776 looking at the first character of the first method call argument, so |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4777 lineup the current line with it. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4778 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4779 @workswith @code{objc-method-call-cont}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4780 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4781 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4782 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4783 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4784 @defun c-lineup-ObjC-method-args |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4785 @findex lineup-ObjC-method-args (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4786 For Objective-C code, line up the colons that separate args. The colon |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4787 on the current line is aligned with the one on the first line. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4788 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4789 @workswith @code{objc-method-args-cont}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4790 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4791 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4792 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4793 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4794 @defun c-lineup-ObjC-method-args-2 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4795 @findex lineup-ObjC-method-args-2 (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4796 Similar to @code{c-lineup-ObjC-method-args} but lines up the colon on |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4797 the current line with the colon on the previous line. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4798 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4799 @workswith @code{objc-method-args-cont}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4800 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4801 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4802 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4803 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4804 @defun c-lineup-runin-statements |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4805 @findex lineup-runin-statements (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4806 Line up statements for coding standards which place the first statement |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4807 in a block on the same line as the block opening brace@footnote{Run-in |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4808 style doesn't really work too well. You might need to write your own |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4809 custom indentation functions to better support this style.}. E.g: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4810 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4811 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4812 @group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4813 int main() |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4814 @{ puts ("Hello!"); |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4815 return 0; @hereFn{c-lineup-runin-statements} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4816 @} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4817 @end group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4818 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4819 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4820 If there is no statement after the opening brace to align with, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4821 @code{nil} is returned. This makes the function usable in list |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4822 expressions. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4823 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4824 @workswith The @code{statement} syntactic symbol. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4825 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4826 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4827 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4828 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4829 @defun c-lineup-streamop |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4830 @findex lineup-streamop (c-) |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
4831 Line up C++ stream operators (i.e., @samp{<<} and @samp{>>}). |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4832 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4833 @workswith @code{stream-op}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4834 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4835 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4836 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4837 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4838 @defun c-lineup-string-cont |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4839 @findex lineup-string-cont (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4840 Line up a continued string under the one it continues. A continued |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4841 string in this sense is where a string literal follows directly after |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4842 another one. E.g: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4843 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4844 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4845 @group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4846 result = prefix + "A message " |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4847 "string."; @hereFn{c-lineup-string-cont} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4848 @end group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4849 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4850 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4851 @code{nil} is returned in other situations, to allow stacking with other |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4852 lineup functions. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4853 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4854 @workswith @code{topmost-intro-cont}, @code{statement-cont}, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4855 @code{arglist-cont}, @code{arglist-cont-nonempty}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4856 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4857 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4858 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4859 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4860 @defun c-lineup-template-args |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4861 @findex lineup-template-args (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4862 Line up the arguments of a template argument list under each other, but |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4863 only in the case where the first argument is on the same line as the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4864 opening @samp{<}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4865 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4866 To allow this function to be used in a list expression, @code{nil} is |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4867 returned if there's no template argument on the first line. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4868 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4869 @workswith @code{template-args-cont}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4870 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4871 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4872 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4873 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4874 @defun c-lineup-topmost-intro-cont |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4875 @findex lineup-topmost-intro-cont (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4876 Line up declaration continuation lines zero or one indentation |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4877 step@footnote{This function is mainly provided to mimic the behavior of |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4878 CC Mode 5.28 and earlier where this case wasn't handled consistently so |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4879 that those lines could be analyzed as either topmost-intro-cont or |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4880 statement-cont. It's used for @code{topmost-intro-cont} by default, but |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4881 you might consider using @code{+} instead.}. For lines preceding a |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4882 definition, zero is used. For other lines, @code{c-basic-offset} is |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4883 added to the indentation. E.g: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4884 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4885 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4886 @group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4887 int |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4888 neg (int i) @hereFn{c-lineup-topmost-intro-cont} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4889 @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4890 return -i; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4891 @} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4892 @end group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4893 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4894 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4895 @noindent |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4896 and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4897 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4898 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4899 @group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4900 struct |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4901 larch @hereFn{c-lineup-topmost-intro-cont} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4902 @{ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4903 double height; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4904 @} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4905 the_larch, @hereFn{c-lineup-topmost-intro-cont} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4906 another_larch; @hereFn{c-lineup-topmost-intro-cont} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4907 @sssTBasicOffset{} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4908 @end group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4909 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4910 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4911 @noindent |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4912 and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4913 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4914 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4915 @group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4916 struct larch |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4917 the_larch, @hereFn{c-lineup-topmost-intro-cont} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4918 another_larch; @hereFn{c-lineup-topmost-intro-cont} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4919 @end group |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4920 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4921 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4922 @workswith @code{topmost-intro-cont}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4923 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4924 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4925 @comment ------------------------------------------------------------ |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4926 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4927 @defun c-lineup-whitesmith-in-block |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4928 @findex lineup-whitesmith-in-block (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4929 Line up lines inside a block in Whitesmith style. It's done in a way |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4930 that works both when the opening brace hangs and when it doesn't. E.g: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4931 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4932 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4933 @group |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4934 something |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4935 @{ |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4936 foo; @hereFn{c-lineup-whitesmith-in-block} |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4937 @} |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4938 @end group |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4939 @end example |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4940 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4941 @noindent |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4942 and |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4943 |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4944 @example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4945 @group |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4946 something @{ |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4947 foo; @hereFn{c-lineup-whitesmith-in-block} |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4948 @} |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4949 @sssTBasicOffset{} |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4950 @end group |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4951 @end example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4952 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4953 In the first case the indentation is kept unchanged, in the second |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4954 @code{c-basic-offset} is added. |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4955 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4956 @workswith @code{defun-close}, @code{defun-block-intro}, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
4957 @code{block-close}, @code{brace-list-close}, @code{brace-list-intro}, |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4958 @code{statement-block-intro} and all @code{in*} symbols, |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
4959 e.g., @code{inclass} and @code{inextern-lang}. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4960 @end defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4961 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4962 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4963 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4964 @node AWK Mode, Odds and Ends, Indentation Functions, Top |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4965 @comment node-name, next, previous, up |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4966 @chapter Status of AWK Mode |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4967 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4968 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4969 @dfn{AWK mode} existed until recently in the file @file{awk-mode.el} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4970 as a mode derived from c-mode. It had not been actively maintained to |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4971 keep pace with the newer @ccmode{}, and its indentation mechanism no |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4972 longer worked satisfactorally. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4973 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4974 The current AWK mode is based around the GNU implementation, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4975 @emph{GAWK version 3.1.0}, though it should work pretty well with any |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4976 AWK. It has now been updated and integrated into @ccmode{} to a |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4977 substantial extent, though as yet not all the features of @ccmode{} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4978 have been adapted to support it. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4979 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4980 If your (X)Emacs is set up to use the old file @file{awk-mode.elc} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4981 (which will usually be the case if you have obtained this @ccmode{} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4982 independently of (X)Emacs itself), or if you are not sure, insert the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4983 following form into your @file{.emacs} or @file{init.el} so that the new |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4984 AWK mode will be used instead: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4985 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4986 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4987 (autoload 'awk-mode "cc-mode" nil t) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4988 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4989 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4990 You can check which AWK mode you are running by displaying the mode |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4991 documentation string with @kbd{C-h m} from an AWK buffer. The newer |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4992 mode's doc string contains @code{To submit a problem report, enter |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4993 `C-c C-b'} near the top of the doc string where the older mode has |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4994 @code{This is much like C mode except ....}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4995 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4996 Since this newer AWK mode makes essential use of a relatively new |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4997 Emacs Lisp feature@footnote{Specifically, the @code{syntax-table} text |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4998 property.}, you need either GNU Emacs 20.1 (or later) or XEmacs 21.4 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
4999 (or later) to use it. If your Emacs version is earlier than one of |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5000 these, the older @file{awk-mode.el} will get loaded and run in place |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5001 of the AWK mode described here, even when you have put the above |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5002 @code{autoload} form into your @file{.emacs} or @file{init.el}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5003 Upgrading your (X)Emacs is strongly recommended if this is the case. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5004 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5005 Here is an overview of which @ccmode{} features currently work with |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5006 AWK mode and which don't: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5007 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5008 @table @asis |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5009 @item Indentation Engine |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5010 The @ccmode{} indentation engine fully supports AWK mode. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5011 @xref{Indentation Engine}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5012 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5013 AWK mode handles code formatted in the conventional AWK fashion: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5014 @samp{@{}s which start actions, user-defined functions, or compound |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5015 statements are placed on the same line as the associated construct; the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5016 matching @samp{@}}s are normally placed under the start of the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5017 respective pattern, function definition, or structured statement. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5018 @c Add in a bit about the @samp{@}} being on the same line when the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5019 @c contents are short. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5020 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5021 The predefined indentation functions (@pxref{Indentation Functions}) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5022 haven't yet been adapted for AWK mode, though some of them may work |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5023 serendipitously. There shouldn't be any problems writing custom |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5024 indentation functions for AWK mode. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5025 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5026 The command @kbd{C-c C-q} (@code{c-indent-defun}) hasn't yet been |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5027 adapted for AWK, though in practice it works properly nearly all the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5028 time. Should it fail, explicitly set the region around the function |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5029 (using @kbd{C-u C-SPC}: @kbd{C-M-h} probably won't work either) then do |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5030 @kbd{C-M-\} (@code{indent-region}). |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5031 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5032 @item Font Locking |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5033 There is a single level of font locking in AWK mode, rather than the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5034 three distinct levels the other modes have. There are several |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5035 idiosyncrasies in AWK mode's font-locking due to the peculiarities of |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5036 the AWK language itself. @xref{AWK Mode Font Locking}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5037 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5038 @item Comment Commands |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5039 @kbd{M-;} (@code{indent-for-comment}) works fine. None of the other |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5040 @ccmode{} comment formatting commands have yet been adapted for AWK |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5041 mode. @xref{Text Filling and Line Breaking}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5042 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5043 @item Movement Commands |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5044 Most of the movement commands work in AWK mode. The most important |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5045 exceptions are @kbd{M-a} (@code{c-beginning-of-statement}) and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5046 @kbd{M-e} (@code{c-end-of-statement}) which haven't yet been adapted. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5047 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5048 The notion of @dfn{defun} has been augmented to include pattern-action |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5049 pairs. See @ref{AWK Mode Defuns} for a description of commands which |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5050 work on AWK ``defuns''. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5051 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5052 Since there is no preprocessor in AWK, the commands which move to |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
5053 preprocessor directives (e.g., @code{c-up-conditional}) are meaningless |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5054 in AWK mode and are not bound in the AWK mode keymap. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5055 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5056 @item Auto-newline Insertion and Clean-ups |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5057 Auto-newline insertion hasn't yet been adapted for AWK. Some of the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5058 clean-ups can actually convert good AWK code into syntactically |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5059 invalid code. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5060 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5061 If auto-newline or its associated clean-ups are enabled generally for |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5062 the modes in @ccmode{}, you are strongly recommended to disable them |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5063 in the AWK Mode hook. @xref{Initialising AWK Mode}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5064 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5065 The clean-up @code{space-before-funcall}, which is independent of |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5066 auto-newline, should never be active in AWK mode (since inserting a |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5067 space between a user function's name and its opening @samp{(} makes |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5068 the call syntactically invalid). If necessary, this should be |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5069 disabled in the AWK Mode hook. @xref{Initialising AWK Mode}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5070 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5071 @end table |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5072 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5073 @menu |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5074 * Initialising AWK Mode:: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5075 * AWK Mode Font Locking:: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5076 * AWK Mode Defuns:: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5077 @end menu |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5078 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5079 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5080 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5081 @node Initialising AWK Mode, AWK Mode Font Locking, , AWK Mode |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5082 @comment node-name, next, previous, up |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5083 @section AWK mode - What to put in your @file{.emacs} or @file{init.el} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5084 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5085 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5086 Much of the AWK mode initialization can, of course, be done by the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5087 @ccmode{} general initialization procedure. You may want to use certain |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5088 @ccmode{} features such as @code{auto-newline} and @code{clean-ups} in |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5089 the other modes, and you might thus have enabled them in a |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5090 @code{c-mode-common-hook} function, as described in @ref{Sample .emacs File}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5091 These features have not yet been amended for AWK mode, and far from |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5092 being useful, can be irritating in AWK mode or actually make AWK code |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5093 syntactically invalid. Adding the following code to your |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5094 @file{.emacs} or @file{init.el} file will disable them for AWK mode. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5095 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5096 @example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5097 (defun my-awk-mode-hook () |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5098 "Disable certain @ccmode{} features which could impair AWK mode." |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5099 (c-toggle-auto-state -1) ; disable automatic insertions of newlines |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5100 (if (memq 'space-before-funcall c-cleanup-list) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5101 (setq c-cleanup-list ; don't automatically insert a space into "foo(" |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5102 (remove 'space-before-funcall c-cleanup-list)))) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5103 (add-hook 'awk-mode-hook 'my-awk-mode-hook) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5104 @end example |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5105 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5106 Naturally you can add your own AWK-specific customizations to this |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5107 function. @xref{Hooks}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5108 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5109 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5110 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5111 @node AWK Mode Font Locking, AWK Mode Defuns, Initialising AWK Mode, AWK Mode |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5112 @comment node-name, next, previous, up |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5113 @section AWK Mode Font Locking |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5114 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5115 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5116 The general appearance of font-locking in AWK mode is much like in any |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5117 other programming mode. @xref{Faces For Font Lock,,,elisp}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5118 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5119 The following faces are, however, used in a non-standard fashion in |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5120 AWK mode: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5121 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5122 @table @asis |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5123 @item @code{font-lock-variable-name-face} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5124 This face was intended for variable declarations. Since variables are |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5125 not declared in AWK, this face is used instead for AWK system |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5126 variables (such as @code{NF}) and ``Special File Names'' (such as |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5127 @code{"/dev/stderr"}). |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5128 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5129 @item @code{font-lock-builtin-face} (Emacs)/@code{font-lock-preprocessor-face} (XEmacs) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5130 This face is normally used for preprocessor directives in @ccmode{}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5131 There are no such things in AWK, so this face is used instead for |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5132 standard functions (such as @code{match}). |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5133 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5134 @item @code{font-lock-string-face} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5135 As well as being used for strings, including localizable strings, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5136 (delimited by @samp{"} and @samp{_"}), this face is also used for AWK |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5137 regular expressions (delimited by @samp{/}). |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5138 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5139 @item @code{font-lock-warning-face} (Emacs)/@code{c-invalid-face} (XEmacs) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5140 This face highlights the following syntactically invalid AWK |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5141 constructs: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5142 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5143 @itemize @bullet |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5144 @item |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5145 An unterminated string or regular expression. Here the opening |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5146 delimiter (@samp{"} or @samp{/} or @samp{_"}) is displayed in |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5147 @code{font-lock-warning-face}. This is most noticeable when typing in a |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5148 new string/regular expression into a buffer, when the warning-face |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5149 serves as a continual reminder to terminate the construct. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5150 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5151 AWK mode fontifies unterminated strings/regular expressions |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5152 differently from other modes: Only the text up to the end of the line |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5153 is fontified as a string (escaped newlines being handled correctly), |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5154 rather than the text up to the next string quote. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5155 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5156 @item |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5157 A space between the function name and opening parenthesis when calling |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5158 a user function. The last character of the function name and the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5159 opening parenthesis are highlighted. This font-locking rule will |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5160 spuriously highlight a valid concatenation expression where an |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5161 identifier precedes a parenthesised expression. Unfortunately. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5162 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5163 @item |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5164 Whitespace following the @samp{\} in what otherwise looks like an |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5165 escaped newline. The @samp{\} is highlighted. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5166 @end itemize |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5167 @end table |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5168 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5169 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5170 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5171 @node AWK Mode Defuns, , AWK Mode Font Locking, AWK Mode |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5172 @comment node-name, next, previous, up |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5173 @section AWK Mode Defuns |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5174 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5175 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5176 In AWK mode, @dfn{defun} means either a user-defined function or a |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5177 pattern-action pair. Either the pattern or the action may be |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5178 implicit. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5179 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5180 The beginning of a defun is recognised heuristically as, more or less, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5181 code which begins in column zero. Having the @samp{@{} in column zero, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5182 as is suggested for some modes, is neither necessary nor helpful in AWK |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5183 mode. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5184 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5185 More precisely, the beginning of a defun is code which begins in |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5186 column zero, and which isn't a closing brace, a comment, or a |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5187 continuation of the previous line. Code is the @dfn{continuation of |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5188 the previous line} when that line is syntactically incomplete, for |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5189 example when it ends with @samp{@{} or an escaped newline. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5190 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5191 The end of a defun is the @samp{@}} which matches the @samp{@{} (if |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5192 any) at the beginning of the action or function body, or the EOL or |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5193 @samp{;} which marks an implicit action. Although this @samp{@}} is |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5194 usually placed in column zero, AWK mode doesn't need it to be placed |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5195 there. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5196 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5197 @table @asis |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5198 @item @kbd{C-M-a} @code{c-awk-beginning-of-defun} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5199 @itemx @kbd{C-M-e} @code{c-awk-end-of-defun} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5200 @findex c-awk-beginning-of-defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5201 @findex awk-beginning-of-defun (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5202 @findex c-awk-end-of-defun |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5203 @findex awk-end-of-defun (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5204 Move point back to the beginning or forward to the end of the current |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5205 AWK defun. These functions can take prefix-arguments, their |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5206 functionality being entirely equivalent to @code{beginning-of-defun} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5207 and @code{end-of-defun}. @xref{Moving by Defuns,,,emacs}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5208 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5209 @item @kbd{C-M-h} @code{c-mark-function} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5210 This works fine with AWK defuns. @xref{Indentation Commands}. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5211 @end table |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5212 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5213 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5214 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5215 @node Odds and Ends, Performance Issues, AWK Mode, Top |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5216 @comment node-name, next, previous, up |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5217 @chapter Odds and Ends |
25829 | 5218 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
5219 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5220 The stuff that didn't fit in anywhere else is documented here. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5221 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5222 @defopt c-require-final-newline |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5223 @vindex require-final-newline (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5224 Controls whether a final newline is ensured when the file is saved. The |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5225 value is an association list that for each language mode specifies the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5226 value to give to @code{require-final-newline} at mode initialization; |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5227 see that variable for details about the value. If a language isn't |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5228 present on the association list, CC Mode won't set |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5229 @code{require-final-newline} in buffers for that language. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5230 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5231 The default is to set @code{require-final-newline} to @code{t} in the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5232 languages that mandates that source files should end with newlines, |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
5233 i.e., C, C++ and Objective-C. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5234 @end defopt |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5235 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5236 @defopt c-echo-syntactic-information-p |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5237 @vindex echo-syntactic-information-p (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5238 If non-@code{nil}, the syntactic analysis for the current line is shown |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5239 in the echo area when it's indented (unless |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5240 @code{c-syntactic-indentation} is @code{nil}). That's useful when |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5241 finding out which syntactic symbols to modify to get the indentation you |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5242 want. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5243 @end defopt |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5244 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5245 @defopt c-report-syntactic-errors |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5246 @vindex report-syntactic-errors (c-) |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5247 If non-@code{nil}, certain syntactic errors are reported with a ding and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5248 a message, for example when an @code{else} is indented for which there |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5249 is no corresponding @code{if}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5250 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5251 Note however that @ccmode{} doesn't make any special effort to check for |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5252 syntactic errors; that's the job of the compiler. The reason it can |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5253 report cases like the one above is that it can't find the correct |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5254 anchoring position to indent the line in that case. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5255 @end defopt |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5256 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5257 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5258 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5259 @node Performance Issues, Limitations and Known Bugs, Odds and Ends, Top |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5260 @comment node-name, next, previous, up |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5261 @chapter Performance Issues |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5262 @cindex performance |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5263 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5264 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5265 @comment FIXME: (ACM, 2003/5/24). Check whether AWK needs mentioning here. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5266 |
25829 | 5267 C and its derivative languages are highly complex creatures. Often, |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5268 ambiguous code situations arise that require @ccmode{} to scan large |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5269 portions of the buffer to determine syntactic context. Such |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5270 pathological code can cause @ccmode{} to perform fairly badly. This |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5271 section gives some insight in how @ccmode{} operates, how that interacts |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5272 with some coding styles, and what you can use to improve performance. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5273 |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
5274 The overall goal is that @ccmode{} shouldn't be overly slow (i.e., take |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5275 more than a fraction of a second) in any interactive operation. |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
5276 i.e., it's tuned to limit the maximum response time in single operations, |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5277 which sometimes is at the expense of batch-like operations like |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5278 reindenting whole blocks. If you find that @ccmode{} gradually gets |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5279 slower and slower in certain situations, perhaps as the file grows in |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5280 size or as the macro or comment you're editing gets bigger, then chances |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5281 are that something isn't working right. You should consider reporting |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5282 it, unless it's something that's mentioned in this section. |
25829 | 5283 |
5284 Because @ccmode{} has to scan the buffer backwards from the current | |
5285 insertion point, and because C's syntax is fairly difficult to parse in | |
5286 the backwards direction, @ccmode{} often tries to find the nearest | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5287 position higher up in the buffer from which to begin a forward scan |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5288 (it's typically an opening or closing parethesis of some kind). The |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5289 farther this position is from the current insertion point, the slower it |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5290 gets. |
25829 | 5291 |
5292 @findex beginning-of-defun | |
5293 @findex defun-prompt-regexp | |
5294 One of the simplest things you can do to reduce scan time, is make sure | |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
5295 any brace that opens a top-level construct@footnote{e.g., a function in |
25829 | 5296 C, or outermost class definition in C++ or Java.} always appears in the |
5297 leftmost column. This is actually an Emacs constraint, as embodied in | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5298 the @code{beginning-of-defun} function which @ccmode{} uses heavily. If |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5299 you hang top-level open braces on the right side of the line, then you |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5300 might want to set the variable @code{defun-prompt-regexp} to something |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5301 reasonable, however that ``something reasonable'' is difficult to |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5302 define, so @ccmode{} doesn't do it for you. |
25829 | 5303 |
5304 @vindex c-Java-defun-prompt-regexp | |
5305 @vindex Java-defun-prompt-regexp (c-) | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5306 A special note about @code{defun-prompt-regexp} in Java mode: The common |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5307 style is to hang the opening braces of functions and classes on the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5308 right side of the line, and that doesn't work well with the Emacs |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5309 approach. @ccmode{} comes with a variable |
25829 | 5310 @code{c-Java-defun-prompt-regexp} which tries to define a regular |
5311 expression usable for this style, but there are problems with it. In | |
5312 some cases it can cause @code{beginning-of-defun} to hang@footnote{This | |
5313 has been observed in Emacs 19.34 and XEmacs 19.15.}. For this reason, | |
5314 it is not used by default, but if you feel adventurous, you can set | |
5315 @code{defun-prompt-regexp} to it in your mode hook. In any event, | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5316 setting and relying on @code{defun-prompt-regexp} will definitely slow |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5317 things down because (X)Emacs will be doing regular expression searches a |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5318 lot, so you'll probably be taking a hit either way! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5319 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5320 @ccmode{} maintains a cache of the opening parentheses of the blocks |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5321 surrounding the point, and it adapts that cache as the point is moved |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5322 around. That means that in bad cases it can take noticeable time to |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5323 indent a line in a new surrounding, but after that it gets fast as long |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5324 as the point isn't moved far off. The farther the point is moved, the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5325 less useful is the cache. Since editing typically is done in ``chunks'' |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5326 rather than on single lines far apart from each other, the cache |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5327 typically gives good performance even when the code doesn't fit the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5328 Emacs approach to finding the defun starts. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5329 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5330 @vindex c-enable-xemacs-performance-kludge-p |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5331 @vindex enable-xemacs-performance-kludge-p (c-) |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5332 XEmacs users can set the variable |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5333 @code{c-enable-xemacs-performance-kludge-p} to non-@code{nil}. This |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5334 tells @ccmode{} to use XEmacs-specific built-in functions which, in some |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5335 circumstances, can locate the top-most opening brace much more quickly than |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5336 @code{beginning-of-defun}. Preliminary testing has shown that for |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
5337 styles where these braces are hung (e.g., most JDK-derived Java styles), |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5338 this hack can improve performance of the core syntax parsing routines |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5339 from 3 to 60 times. However, for styles which @emph{do} conform to |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5340 Emacs' recommended style of putting top-level braces in column zero, |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5341 this hack can degrade performance by about as much. Thus this variable |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5342 is set to @code{nil} by default, since the Emacs-friendly styles should |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5343 be more common (and encouraged!). Note that this variable has no effect |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5344 in Emacs since the necessary built-in functions don't exist (in Emacs |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5345 21.3 as of this writing in May 2003). |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5346 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5347 Text properties are used to speed up skipping over syntactic whitespace, |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
5348 i.e., comments and preprocessor directives. Indenting a line after a |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5349 huge macro definition can be slow the first time, but after that the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5350 text properties are in place and it should be fast (even after you've |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5351 edited other parts of the file and then moved back). |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5352 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5353 Font locking can be a CPU hog, especially the font locking done on |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5354 decoration level 3 which tries to be very accurate. Note that that |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5355 level is designed to be used with a font lock support mode that only |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
5356 fontifies the text that's actually shown, i.e., Lazy Lock or Just-in-time |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5357 Lock mode, so make sure you use one of them. Fontification of a whole |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5358 buffer with some thousand lines can often take over a minute. That is |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5359 a known weakness; the idea is that it never should happen. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5360 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5361 The most effective way to speed up font locking is to reduce the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5362 decoration level to 2 by setting @code{font-lock-maximum-decoration} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5363 appropriately. That level is designed to be as pretty as possible |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5364 without sacrificing performance. @xref{Font Locking Preliminaries}, for |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5365 more info. |
25829 | 5366 |
5367 | |
36923 | 5368 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
5369 @node Limitations and Known Bugs, Frequently Asked Questions, Performance Issues, Top | |
5370 @comment node-name, next, previous, up | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5371 @chapter Limitations and Known Bugs |
36923 | 5372 @cindex limitations |
5373 @cindex bugs | |
5374 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
5375 | |
5376 @itemize @bullet | |
5377 @item | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5378 There is no way to apply auto newline settings (@pxref{Auto-newline |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5379 Insertion}) on already typed lines. That's only a feature to ease |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5380 interactive editing. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5381 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5382 To generalize this issue a bit: @ccmode{} is not intended to be used as |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5383 a reformatter for old code in some more or less batch-like way. With |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5384 the exception of some functions like @code{c-indent-region}, it's only |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5385 geared to be used interactively to edit new code. There's currently no |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5386 intention to change this goal. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5387 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5388 If you want to reformat old code, you're probably better off using some |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
5389 other tool instead, e.g., @ref{Top, , GNU indent, indent, The `indent' |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5390 Manual}, which has more powerful reformatting capabilities than |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5391 @ccmode{}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5392 |
36923 | 5393 @item |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5394 @vindex signal-error-on-buffer-boundary |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5395 XEmacs has a variable called @code{signal-error-on-buffer-boundary}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5396 It's used as a solution to user interface problems associated with |
36923 | 5397 buffer movement and the @code{zmacs-region} deactivation on errors. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5398 However, setting this variable to a non-default value in XEmacs 19 and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5399 20 had the deleterious side effect of breaking many built-in primitive |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5400 functions. @strong{Do not set this variable to @code{nil} in XEmacs |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5401 19 and 20}; you will cause serious problems in @ccmode{} and probably |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5402 other XEmacs packages! In XEmacs 21 the effects of the variable is |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5403 limited to some functions that are only used interactively, so it's |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5404 not a problem there. |
36923 | 5405 @end itemize |
5406 | |
5407 | |
25829 | 5408 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
36923 | 5409 @node Frequently Asked Questions, Getting the Latest CC Mode Release, Limitations and Known Bugs, Top |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5410 @comment node-name, next, previous, up |
36923 | 5411 @appendix Frequently Asked Questions |
25829 | 5412 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
5413 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5414 @itemize @bullet |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5415 @item |
25829 | 5416 @kindex C-x h |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5417 @kindex C-M-\ |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5418 @emph{How do I reindent the whole file?} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5419 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5420 Visit the file and hit @kbd{C-x h} to mark the whole buffer. Then hit |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5421 @kbd{C-M-\}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5422 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5423 @item |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5424 @kindex C-M-q |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5425 @kindex C-M-u |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5426 @emph{How do I reindent the current block?} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5427 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5428 First move to the brace which opens the block with @kbd{C-M-u}, then |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5429 reindent that expression with @kbd{C-M-q}. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5430 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5431 @item |
25829 | 5432 @kindex RET |
5433 @kindex C-j | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5434 @emph{Why doesn't the @kbd{RET} key indent the new line?} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5435 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5436 Emacs' convention is that @kbd{RET} just adds a newline, and that |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5437 @kbd{C-j} adds a newline and indents it. You can make @kbd{RET} do this |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5438 too by adding this to your @code{c-mode-common-hook}: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5439 |
25829 | 5440 @example |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5441 (define-key c-mode-base-map "\C-m" 'c-context-line-break) |
25829 | 5442 @end example |
5443 | |
5444 This is a very common question. If you want this to be the default | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5445 behavior, don't lobby me, lobby RMS! @t{:-)} |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5446 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5447 @item |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5448 @emph{I put @code{(c-set-offset 'substatement-open 0)} in my |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5449 @file{.emacs} file but I get an error saying that @code{c-set-offset}'s |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5450 function definition is void. What's wrong?} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5451 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5452 This means that @ccmode{} wasn't loaded into your Emacs session by the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5453 time the @code{c-set-offset} call was reached, most likely because |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5454 @ccmode{} is being autoloaded. Instead of putting the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5455 @code{c-set-offset} line in your top-level @file{.emacs} file, put it in |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5456 your @code{c-mode-common-hook}, or simply modify @code{c-offsets-alist} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5457 directly: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5458 |
25829 | 5459 @example |
30396
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
5460 (setq c-offsets-alist '((substatement-open . 0))) |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5461 @end example |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5462 |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5463 @item |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5464 @kindex M-a |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5465 @kindex M-e |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5466 @emph{@kbd{M-a} and @kbd{M-e} used to move over entire balanced brace |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5467 lists, but now they move into blocks. How do I get the old behavior |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5468 back?} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5469 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5470 Use @kbd{C-M-f} and @kbd{C-M-b} to move over balanced brace blocks. Use |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5471 @kbd{M-a} and @kbd{M-e} to move by statements, which will also move into |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5472 blocks. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5473 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5474 @item |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5475 @emph{Whenever I try to indent a line or type an ``electric'' key such |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5476 as @kbd{;}, @kbd{@{}, or @kbd{@}}, I get an error that look like this: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5477 @code{Invalid function: (macro . #[...}. What gives?} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5478 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5479 This is a common error when @ccmode{} hasn't been compiled correctly, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5480 especially under Emacs 19.34@footnote{Technically, it's because some |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5481 macro wasn't defined during the compilation, so the byte compiler put |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5482 in function calls instead of the macro expansions. Later, when the |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5483 interpreter tries to call the macro as a function, it shows this |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5484 (somewhat cryptic) error message.}. If you are using the standalone |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5485 @ccmode{} distribution, try recompiling it according to the instructions |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5486 in the @file{README} file. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5487 @end itemize |
25829 | 5488 |
5489 | |
5490 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
36923 | 5491 @node Getting the Latest CC Mode Release, Mailing Lists and Submitting Bug Reports, Frequently Asked Questions, Top |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5492 @comment node-name, next, previous, up |
36923 | 5493 @appendix Getting the Latest CC Mode Release |
25829 | 5494 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
5495 | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5496 @ccmode{} has been standard with all versions of Emacs since 19.34 and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5497 of XEmacs since 19.16. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5498 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5499 @cindex web site |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5500 Due to release schedule skew, it is likely that all of these Emacsen |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47737
diff
changeset
|
5501 have old versions of @ccmode{} and so should be upgraded. Access to the |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5502 @ccmode{} source code, as well as more detailed information on Emacsen |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5503 compatibility, etc. are all available on the web site: |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5504 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5505 @quotation |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5506 @uref{http://cc-mode.sourceforge.net/} |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5507 @end quotation |
25829 | 5508 |
5509 | |
36923 | 5510 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
5511 @node Mailing Lists and Submitting Bug Reports, Sample .emacs File, Getting the Latest CC Mode Release, Top | |
5512 @comment node-name, next, previous, up | |
5513 @appendix Mailing Lists and Submitting Bug Reports | |
5514 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | |
5515 | |
5516 @kindex C-c C-b | |
5517 @findex c-submit-bug-report | |
5518 @findex submit-bug-report (c-) | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5519 To report bugs, use the @kbd{C-c C-b} (bound to |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5520 @code{c-submit-bug-report}) command. This provides vital information |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5521 we need to reproduce your problem. Make sure you include a concise, |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5522 but complete code example. Please try to boil your example down to |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5523 just the essential code needed to reproduce the problem, and include |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5524 an exact recipe of steps needed to expose the bug. Be especially sure |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5525 to include any code that appears @emph{before} your bug example, if |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5526 you think it might affect our ability to reproduce it. |
36923 | 5527 |
5528 Please try to produce the problem in an Emacs instance without any | |
55832
cd954d951766
Put commas after i.e. and e.g. Minor cleanups.
Richard M. Stallman <rms@gnu.org>
parents:
53118
diff
changeset
|
5529 customizations loaded (i.e., start it with the @samp{-q --no-site-file} |
36923 | 5530 arguments). If it works correctly there, the problem might be caused by |
5531 faulty customizations in either your own or your site configuration. In | |
5532 that case, we'd appreciate if you isolate the Emacs Lisp code that trigs | |
5533 the bug and include it in your report. | |
5534 | |
5535 @cindex bug report mailing list | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5536 Bug reports are sent to @email{bug-cc-mode@@gnu.org}. You can also send |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5537 other questions and suggestions (kudos? @t{;-)} to that address. It's a |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5538 mailing list which you can join or browse an archive of; see the web |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5539 site at @uref{http://cc-mode.sourceforge.net/} for further details. |
36923 | 5540 |
5541 @cindex announcement mailing list | |
5542 If you want to get announcements of new @ccmode{} releases, send the | |
5543 word @emph{subscribe} in the body of a message to | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5544 @email{cc-mode-announce-request@@lists.sourceforge.net}. It's possible |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5545 to subscribe from the web site too. Announcements will also be posted |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5546 to the Usenet newsgroups @code{gnu.emacs.sources}, @code{comp.emacs} and |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5547 @code{comp.emacs.xemacs}. |
36923 | 5548 |
5549 | |
25829 | 5550 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5551 @node Sample .emacs File, Command and Function Index, Mailing Lists and Submitting Bug Reports, Top |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5552 @comment node-name, next, previous, up |
36923 | 5553 @appendix Sample .emacs file |
25829 | 5554 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
5555 | |
5556 @example | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5557 ;; Here's a sample .emacs file that might help you along the way. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5558 ;; Just copy this region and paste it into your .emacs file. You may |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5559 ;; want to change some of the actual values. |
25829 | 5560 |
5561 (defconst my-c-style | |
5562 '((c-tab-always-indent . t) | |
5563 (c-comment-only-line-offset . 4) | |
5564 (c-hanging-braces-alist . ((substatement-open after) | |
5565 (brace-list-open))) | |
5566 (c-hanging-colons-alist . ((member-init-intro before) | |
5567 (inher-intro) | |
5568 (case-label after) | |
5569 (label after) | |
5570 (access-label after))) | |
5571 (c-cleanup-list . (scope-operator | |
5572 empty-defun-braces | |
5573 defun-close-semi)) | |
5574 (c-offsets-alist . ((arglist-close . c-lineup-arglist) | |
5575 (substatement-open . 0) | |
5576 (case-label . 4) | |
5577 (block-open . 0) | |
5578 (knr-argdecl-intro . -))) | |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5579 (c-echo-syntactic-information-p . t)) |
25829 | 5580 "My C Programming Style") |
5581 | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5582 ;; offset customizations not in my-c-style |
30396
460a86ced57c
@setfilename to ../info/ccmode.
Gerd Moellmann <gerd@gnu.org>
parents:
30044
diff
changeset
|
5583 (setq c-offsets-alist '((member-init-intro . ++))) |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5584 |
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5585 ;; Customizations for all modes in CC Mode. |
25829 | 5586 (defun my-c-mode-common-hook () |
5587 ;; add my personal style and set it for the current buffer | |
5588 (c-add-style "PERSONAL" my-c-style t) | |
5589 ;; other customizations | |
5590 (setq tab-width 8 | |
5591 ;; this will make sure spaces are used instead of tabs | |
5592 indent-tabs-mode nil) | |
5593 ;; we like auto-newline and hungry-delete | |
5594 (c-toggle-auto-hungry-state 1) | |
39267 | 5595 ;; key bindings for all supported languages. We can put these in |
25829 | 5596 ;; c-mode-base-map because c-mode-map, c++-mode-map, objc-mode-map, |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5597 ;; java-mode-map, idl-mode-map, and pike-mode-map inherit from it. |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5598 (define-key c-mode-base-map "\C-m" 'c-context-line-break)) |
25829 | 5599 |
5600 (add-hook 'c-mode-common-hook 'my-c-mode-common-hook) | |
5601 @end example | |
5602 | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5603 |
25829 | 5604 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5605 @node Command and Function Index, Variable Index, Sample .emacs File, Top |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5606 @comment node-name, next, previous, up |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5607 @unnumbered Command and Function Index |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5608 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5609 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5610 Since most @ccmode{} commands are prepended with the string |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5611 @samp{c-}, each appears under its @code{c-@var{thing}} name and its |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5612 @code{@var{thing} (c-)} name. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5613 @iftex |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5614 @sp 2 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5615 @end iftex |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5616 @printindex fn |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5617 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5618 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5619 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5620 @node Variable Index, Concept Index, Command and Function Index, Top |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5621 @comment node-name, next, previous, up |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5622 @unnumbered Variable Index |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5623 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5624 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5625 Since most @ccmode{} variables are prepended with the string |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5626 @samp{c-}, each appears under its @code{c-@var{thing}} name and its |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5627 @code{@var{thing} (c-)} name. |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5628 @iftex |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5629 @sp 2 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5630 @end iftex |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5631 @printindex vr |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5632 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5633 |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5634 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5635 @node Concept Index, , Variable Index, Top |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5636 @comment node-name, next, previous, up |
25829 | 5637 @unnumbered Concept Index |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5638 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
25829 | 5639 |
5640 @printindex cp | |
5641 | |
5642 | |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5643 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
53118
04d26b9d5b56
* cc-mode.texi: Updated for CC Mode 5.30.
Martin Stjernholm <mast@lysator.liu.se>
parents:
52401
diff
changeset
|
5644 @comment Epilogue. |
26819
a19be798eaea
Installed cc-mode version 5.26.
Gerd Moellmann <gerd@gnu.org>
parents:
26490
diff
changeset
|
5645 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
36923 | 5646 |
5647 @iftex | |
25829 | 5648 @page |
5649 @summarycontents | |
5650 @contents | |
36923 | 5651 @end iftex |
5652 | |
25829 | 5653 @bye |
52401 | 5654 |
5655 @ignore | |
5656 arch-tag: c4cab162-5e57-4366-bdce-4a9db2fc97f0 | |
5657 @end ignore |