936 |
the file FILE. |
the file FILE. |
937 |
|
|
938 |
+++ |
+++ |
939 |
|
** CC Mode changes. |
940 |
|
|
941 |
|
*** Font lock support. |
942 |
|
CC Mode now provides font lock support for all its languages. This |
943 |
|
supersedes the font lock patterns that have been in the core font lock |
944 |
|
package for C, C++, Java and Objective-C. Like indentation, font |
945 |
|
locking is done in a uniform way across all languages (except the new |
946 |
|
AWK mode - see below). That means that the new font locking will be |
947 |
|
different from the old patterns in various details for most languages. |
948 |
|
|
949 |
|
The main goal of the font locking in CC Mode is accuracy, to provide a |
950 |
|
dependable aid in recognizing the various constructs. Some, like |
951 |
|
strings and comments, are easy to recognize while others like |
952 |
|
declarations and types can be very tricky. CC Mode can go to great |
953 |
|
lengths to recognize declarations and casts correctly, especially when |
954 |
|
the types aren't recognized by standard patterns. This is a fairly |
955 |
|
demanding analysis which can be slow on older hardware, and it can |
956 |
|
therefore be disabled by choosing a lower decoration level with the |
957 |
|
variable font-lock-maximum-decoration. |
958 |
|
|
959 |
|
Note that the most demanding font lock level has been tuned with lazy |
960 |
|
fontification in mind, i.e. there should be a support mode that waits |
961 |
|
with the fontification until the text is actually shown |
962 |
|
(e.g. Just-in-time Lock mode, which is the default, or Lazy Lock |
963 |
|
mode). Fontifying a file with several thousand lines in one go can |
964 |
|
take the better part of a minute. |
965 |
|
|
966 |
|
**** The (c|c++|objc|java|idl|pike)-font-lock-extra-types variables |
967 |
|
are now used by CC Mode to recognize identifiers that are certain to |
968 |
|
be types. (They are also used in cases that aren't related to font |
969 |
|
locking.) At the maximum decoration level, types are often recognized |
970 |
|
properly anyway, so these variables should be fairly restrictive and |
971 |
|
not contain patterns for uncertain types. |
972 |
|
|
973 |
|
**** Support for documentation comments. |
974 |
|
There is a "plugin" system to fontify documentation comments like |
975 |
|
Javadoc and the markup within them. It's independent of the host |
976 |
|
language, so it's possible to e.g. turn on Javadoc font locking in C |
977 |
|
buffers. See the variable c-doc-comment-style for details. |
978 |
|
|
979 |
|
Currently two kinds of doc comment styles are recognized: Suns Javadoc |
980 |
|
and Autodoc which is used in Pike. This is by no means a complete |
981 |
|
list of the most common tools; if your doc comment extractor of choice |
982 |
|
is missing then please drop a note to bug-cc-mode@gnu.org. |
983 |
|
|
984 |
|
**** Better handling of C++ templates. |
985 |
|
As a side effect of the more accurate font locking, C++ templates are |
986 |
|
now handled much better. The angle brackets that delimit them are |
987 |
|
given parenthesis syntax so that they can be navigated like other |
988 |
|
parens. |
989 |
|
|
990 |
|
This also improves indentation of templates, although there still is |
991 |
|
work to be done in that area. E.g. it's required that multiline |
992 |
|
template clauses are written in full and then refontified to be |
993 |
|
recognized, and the indentation of nested templates is a bit odd and |
994 |
|
not as configurable as it ought to be. |
995 |
|
|
996 |
|
**** Improved handling of Objective-C and CORBA IDL. |
997 |
|
Especially the support for Objective-C and IDL has gotten an overhaul. |
998 |
|
The special "@" declarations in Objective-C are handled correctly. |
999 |
|
All the keywords used in CORBA IDL, PSDL, and CIDL are recognized and |
1000 |
|
handled correctly, also wrt indentation. |
1001 |
|
|
1002 |
|
*** Support for the AWK language. |
1003 |
|
Support for the AWK language has been introduced. The implementation is |
1004 |
|
based around GNU AWK version 3.1, but it should work pretty well with |
1005 |
|
any AWK. As yet, not all features of CC Mode have been adapted for AWK. |
1006 |
|
Here is a summary: |
1007 |
|
|
1008 |
|
**** Indentation Engine |
1009 |
|
The CC Mode indentation engine fully supports AWK mode. |
1010 |
|
|
1011 |
|
AWK mode handles code formatted in the conventional AWK fashion: `{'s |
1012 |
|
which start actions, user-defined functions, or compound statements are |
1013 |
|
placed on the same line as the associated construct; the matching `}'s |
1014 |
|
are normally placed under the start of the respective pattern, function |
1015 |
|
definition, or structured statement. |
1016 |
|
|
1017 |
|
The predefined indentation functions haven't yet been adapted for AWK |
1018 |
|
mode, though some of them may work serendipitously. There shouldn't be |
1019 |
|
any problems writing custom indentation functions for AWK mode. |
1020 |
|
|
1021 |
|
The command C-c C-q (c-indent-defun) hasn't yet been adapted for AWK, |
1022 |
|
though in practice it works properly nearly all the time. Should it |
1023 |
|
fail, explicitly set the region around the function (using C-u C-SPC: |
1024 |
|
C-M-h probably won't work either) then do C-M-\ (indent-region). |
1025 |
|
|
1026 |
|
**** Font Locking |
1027 |
|
There is a single level of font locking in AWK mode, rather than the |
1028 |
|
three distinct levels the other modes have. There are several |
1029 |
|
idiosyncrasies in AWK mode's font-locking due to the peculiarities of |
1030 |
|
the AWK language itself. |
1031 |
|
|
1032 |
|
**** Comment Commands |
1033 |
|
M-; (indent-for-comment) works fine. None of the other CC Mode |
1034 |
|
comment formatting commands have yet been adapted for AWK mode. |
1035 |
|
|
1036 |
|
**** Movement Commands |
1037 |
|
Most of the movement commands work in AWK mode. The most important |
1038 |
|
exceptions are M-a (c-beginning-of-statement) and M-e |
1039 |
|
(c-end-of-statement) which haven't yet been adapted. |
1040 |
|
|
1041 |
|
The notion of "defun" has been augmented to include AWK pattern-action |
1042 |
|
pairs. C-M-a (c-awk-beginning-of-defun) and C-M-e (c-awk-end-of-defun) |
1043 |
|
recognise these pattern-action pairs, as well as user defined |
1044 |
|
functions. |
1045 |
|
|
1046 |
|
**** Auto-newline Insertion and Clean-ups |
1047 |
|
Auto-newline insertion hasn't yet been adapted for AWK. Some of |
1048 |
|
the clean-ups can actually convert good AWK code into syntactically |
1049 |
|
invalid code. These features are best disabled in AWK buffers. |
1050 |
|
|
1051 |
|
*** New syntactic symbols in IDL mode. |
1052 |
|
The top level constructs "module" and "composition" (from CIDL) are |
1053 |
|
now handled like "namespace" in C++: They are given syntactic symbols |
1054 |
|
module-open, module-close, inmodule, composition-open, |
1055 |
|
composition-close, and incomposition. |
1056 |
|
|
1057 |
|
*** New functions to do hungry delete without enabling hungry delete mode. |
1058 |
|
The functions c-hungry-backspace and c-hungry-delete-forward can be |
1059 |
|
bound to keys to get this feature without toggling a mode. |
1060 |
|
Contributed by Kevin Ryde. |
1061 |
|
|
1062 |
|
*** Better control over require-final-newline. |
1063 |
|
The variable that controls how to handle a final newline when the |
1064 |
|
buffer is saved, require-final-newline, is now customizable on a |
1065 |
|
per-mode basis through c-require-final-newline. The default is to set |
1066 |
|
it to t only in languages that mandate a final newline in source files |
1067 |
|
(C, C++ and Objective-C). |
1068 |
|
|
1069 |
|
*** Slight API change for the syntactic context used by lineup functions. |
1070 |
|
The syntactic context stored in c-syntactic-context has been changed |
1071 |
|
to allow more information. This might affect custom lineup functions, |
1072 |
|
but only if they use that variable directly. See its docstring for |
1073 |
|
more details. |
1074 |
|
|
1075 |
|
*** API changes for derived modes. |
1076 |
|
There have been extensive changes "under the hood" which can affect |
1077 |
|
derived mode writers. Some of these changes are likely to cause |
1078 |
|
incompatibilities with existing derived modes, but on the other hand |
1079 |
|
care has now been taken to make it possible to extend and modify CC |
1080 |
|
Mode with less risk of such problems in the future. |
1081 |
|
|
1082 |
|
**** New language variable system. |
1083 |
|
See the comment blurb near the top of cc-langs.el. |
1084 |
|
|
1085 |
|
**** New initialization functions. |
1086 |
|
The initialization procedure has been split up into more functions to |
1087 |
|
give better control: c-basic-common-init, c-font-lock-init, and |
1088 |
|
c-init-language-vars. |
1089 |
|
|
1090 |
|
*** Changes in analysis of nested syntactic constructs. |
1091 |
|
The syntactic analysis engine has better handling of cases where |
1092 |
|
several syntactic constructs appear nested on the same line. They are |
1093 |
|
now handled as if each construct started on a line of its own. |
1094 |
|
|
1095 |
|
This means that CC Mode now indents some cases differently, and |
1096 |
|
although it's more consistent there might be cases where the old way |
1097 |
|
gave results that's more to one's liking. So if you find a situation |
1098 |
|
where you think that the indentation has become worse, please report |
1099 |
|
it to bug-cc-mode@gnu.org. |
1100 |
|
|
1101 |
|
**** New syntactic symbol substatement-label. |
1102 |
|
This symbol is used when a label is inserted between a statement and |
1103 |
|
its substatement. E.g: |
1104 |
|
|
1105 |
|
if (x) |
1106 |
|
x_is_true: |
1107 |
|
do_stuff(); |
1108 |
|
|
1109 |
|
*** Better handling of multiline macros. |
1110 |
|
|
1111 |
|
**** Syntactic indentation inside macros. |
1112 |
|
The contents of multiline #define's are now analyzed and indented |
1113 |
|
syntactically just like other code. This can be disabled by the new |
1114 |
|
variable c-syntactic-indentation-in-macros. A new syntactic symbol |
1115 |
|
cpp-define-intro has been added to control the initial indentation |
1116 |
|
inside #define's. |
1117 |
|
|
1118 |
|
**** New lineup function c-lineup-cpp-define. |
1119 |
|
Now used by default to line up macro continuation lines. The behavior |
1120 |
|
of this function closely mimics the indentation one gets if the macro |
1121 |
|
is indented while the line continuation backslashes are temporarily |
1122 |
|
removed. If syntactic indentation in macros is turned off, it works |
1123 |
|
much line c-lineup-dont-change, which was used earlier, but handles |
1124 |
|
empty lines within the macro better. |
1125 |
|
|
1126 |
|
**** Automatically inserted newlines continues the macro if used within one. |
1127 |
|
This applies to the newlines inserted by the auto-newline mode, and to |
1128 |
|
c-context-line-break and c-context-open-line. |
1129 |
|
|
1130 |
|
**** Better alignment of line continuation backslashes. |
1131 |
|
c-backslash-region tries to adapt to surrounding backslashes. New |
1132 |
|
variable c-backslash-max-column which put a limit on how far out |
1133 |
|
backslashes can be moved. |
1134 |
|
|
1135 |
|
**** Automatic alignment of line continuation backslashes. |
1136 |
|
This is controlled by the new variable c-auto-align-backslashes. It |
1137 |
|
affects c-context-line-break, c-context-open-line and newlines |
1138 |
|
inserted in auto-newline mode. |
1139 |
|
|
1140 |
|
**** Line indentation works better inside macros. |
1141 |
|
Regardless whether syntactic indentation and syntactic indentation |
1142 |
|
inside macros are enabled or not, line indentation now ignores the |
1143 |
|
line continuation backslashes. This is most noticeable when syntactic |
1144 |
|
indentation is turned off and there are empty lines (save for the |
1145 |
|
backslash) in the macro. |
1146 |
|
|
1147 |
|
*** indent-for-comment is more customizable. |
1148 |
|
The behavior of M-; (indent-for-comment) is now configurable through |
1149 |
|
the variable c-indent-comment-alist. The indentation behavior based |
1150 |
|
on the preceding code on the line, e.g. to get two spaces after #else |
1151 |
|
and #endif but indentation to comment-column in most other cases |
1152 |
|
(something which was hardcoded earlier). |
1153 |
|
|
1154 |
|
*** New function c-context-open-line. |
1155 |
|
It's the open-line equivalent of c-context-line-break. |
1156 |
|
|
1157 |
|
*** New lineup functions |
1158 |
|
|
1159 |
|
**** c-lineup-string-cont |
1160 |
|
This lineup function lines up a continued string under the one it |
1161 |
|
continues. E.g: |
1162 |
|
|
1163 |
|
result = prefix + "A message " |
1164 |
|
"string."; <- c-lineup-string-cont |
1165 |
|
|
1166 |
|
**** c-lineup-cascaded-calls |
1167 |
|
Lines up series of calls separated by "->" or ".". |
1168 |
|
|
1169 |
|
**** c-lineup-knr-region-comment |
1170 |
|
Gives (what most people think is) better indentation of comments in |
1171 |
|
the "K&R region" between the function header and its body. |
1172 |
|
|
1173 |
|
**** c-lineup-gcc-asm-reg |
1174 |
|
Provides better indentation inside asm blocks. Contributed by Kevin |
1175 |
|
Ryde. |
1176 |
|
|
1177 |
|
**** c-lineup-argcont |
1178 |
|
Lines up continued function arguments after the preceding comma. |
1179 |
|
Contributed by Kevin Ryde. |
1180 |
|
|
1181 |
|
*** Better caching of the syntactic context. |
1182 |
|
CC Mode caches the positions of the opening parentheses (of any kind) |
1183 |
|
of the lists surrounding the point. Those positions are used in many |
1184 |
|
places as anchor points for various searches. The cache is now |
1185 |
|
improved so that it can be reused to a large extent when the point is |
1186 |
|
moved. The less it moves, the less needs to be recalculated. |
1187 |
|
|
1188 |
|
The effect is that CC Mode should be fast most of the time even when |
1189 |
|
opening parens are hung (i.e. aren't in column zero). It's typically |
1190 |
|
only the first time after the point is moved far down in a complex |
1191 |
|
file that it'll take noticeable time to find out the syntactic |
1192 |
|
context. |
1193 |
|
|
1194 |
|
*** Statements are recognized in a more robust way. |
1195 |
|
Statements are recognized most of the time even when they occur in an |
1196 |
|
"invalid" context, e.g. in a function argument. In practice that can |
1197 |
|
happen when macros are involved. |
1198 |
|
|
1199 |
|
*** Improved the way c-indent-exp chooses the block to indent. |
1200 |
|
It now indents the block for the closest sexp following the point |
1201 |
|
whose closing paren ends on a different line. This means that the |
1202 |
|
point doesn't have to be immediately before the block to indent. |
1203 |
|
Also, only the block and the closing line is indented; the current |
1204 |
|
line is left untouched. |
1205 |
|
|
1206 |
|
*** Added toggle for syntactic indentation. |
1207 |
|
The function c-toggle-syntactic-indentation can be used to toggle |
1208 |
|
syntactic indentation. |
1209 |
|
|
1210 |
** The command line option --no-windows has been changed to |
** The command line option --no-windows has been changed to |
1211 |
--no-window-system. The old one still works, but is deprecated. |
--no-window-system. The old one still works, but is deprecated. |
1212 |
|
|