Mercurial > emacs
annotate lisp/progmodes/cc-vars.el @ 23651:dcd6688d67be
(MULTIBYTE_BYTES_WIDTH): Check validity of a multibyte character.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Fri, 06 Nov 1998 00:44:16 +0000 |
parents | dad4e4facdc0 |
children | 5b0864259a4b |
rev | line source |
---|---|
18720 | 1 ;;; cc-vars.el --- user customization variables for CC Mode |
2 | |
20919
9cffecf3b1ca
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20144
diff
changeset
|
3 ;; Copyright (C) 1985,87,92,93,94,95,96,97,98 Free Software Foundation, Inc. |
18720 | 4 |
5 ;; Authors: 1992-1997 Barry A. Warsaw | |
6 ;; 1987 Dave Detlefs and Stewart Clamen | |
7 ;; 1985 Richard M. Stallman | |
8 ;; Maintainer: cc-mode-help@python.org | |
9 ;; Created: 22-Apr-1997 (split from cc-mode.el) | |
20144
56d81cc7b4f5
(c-progress-interval): Document new semantics
Karl Heuer <kwzh@gnu.org>
parents:
20140
diff
changeset
|
10 ;; Version: See cc-mode.el |
18720 | 11 ;; Keywords: c languages oop |
12 | |
13 ;; This file is part of GNU Emacs. | |
14 | |
15 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
16 ;; it under the terms of the GNU General Public License as published by | |
17 ;; the Free Software Foundation; either version 2, or (at your option) | |
18 ;; any later version. | |
19 | |
20 ;; GNU Emacs is distributed in the hope that it will be useful, | |
21 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 ;; GNU General Public License for more details. | |
24 | |
25 ;; You should have received a copy of the GNU General Public License | |
26 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
27 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
28 ;; Boston, MA 02111-1307, USA. | |
29 | |
30 (require 'custom) | |
31 | |
32 | |
33 (defcustom c-strict-syntax-p nil | |
34 "*If non-nil, all syntactic symbols must be found in `c-offsets-alist'. | |
35 If the syntactic symbol for a particular line does not match a symbol | |
36 in the offsets alist, an error is generated, otherwise no error is | |
37 reported and the syntactic symbol is ignored." | |
38 :type 'boolean | |
39 :group 'c) | |
40 | |
41 (defcustom c-echo-syntactic-information-p nil | |
42 "*If non-nil, syntactic info is echoed when the line is indented." | |
43 :type 'boolean | |
44 :group 'c) | |
45 | |
46 (defcustom c-basic-offset 4 | |
47 "*Amount of basic offset used by + and - symbols in `c-offsets-alist'." | |
48 :type 'integer | |
49 :group 'c) | |
50 | |
51 (defcustom c-tab-always-indent t | |
52 "*Controls the operation of the TAB key. | |
53 If t, hitting TAB always just indents the current line. If nil, | |
54 hitting TAB indents the current line if point is at the left margin or | |
55 in the line's indentation, otherwise it insert a `real' tab character | |
56 \(see note\). If other than nil or t, then tab is inserted only | |
57 within literals -- defined as comments and strings -- and inside | |
58 preprocessor directives, but line is always reindented. | |
59 | |
60 Note: The value of `indent-tabs-mode' will determine whether a real | |
61 tab character will be inserted, or the equivalent number of space. | |
62 When inserting a tab, actually the function stored in the variable | |
63 `c-insert-tab-function' is called. | |
64 | |
65 Note: indentation of lines containing only comments is also controlled | |
66 by the `c-comment-only-line-offset' variable." | |
67 :type '(radio | |
68 :extra-offset 8 | |
69 :format "%{C Tab Always Indent%}:\n The TAB key:\n%v" | |
70 (const :tag "always indents, never inserts TAB" t) | |
71 (const :tag "indents in left margin, otherwise inserts TAB" nil) | |
72 (const :tag "inserts TAB in literals, otherwise indent" other)) | |
73 :group 'c) | |
74 | |
75 (defcustom c-insert-tab-function 'insert-tab | |
76 "*Function used when inserting a tab for \\[TAB]. | |
77 Only used when `c-tab-always-indent' indicates a `real' tab character | |
78 should be inserted. Value must be a function taking no arguments." | |
79 :type 'function | |
80 :group 'c) | |
81 | |
82 (defcustom c-comment-only-line-offset 0 | |
83 "*Extra offset for line which contains only the start of a comment. | |
84 Can contain an integer or a cons cell of the form: | |
85 | |
86 (NON-ANCHORED-OFFSET . ANCHORED-OFFSET) | |
87 | |
88 Where NON-ANCHORED-OFFSET is the amount of offset given to | |
89 non-column-zero anchored comment-only lines, and ANCHORED-OFFSET is | |
90 the amount of offset to give column-zero anchored comment-only lines. | |
91 Just an integer as value is equivalent to (<val> . -1000)." | |
92 :type '(choice (integer :tag "Non-anchored offset") | |
93 (cons :tag "Non-anchored & anchored offset" | |
94 :value (0 . 0) | |
95 :extra-offset 8 | |
96 (integer :tag "Non-anchored offset") | |
97 (integer :tag "Anchored offset"))) | |
98 :group 'c) | |
99 | |
100 (defcustom c-indent-comments-syntactically-p nil | |
101 "*Specifies how comment-only lines should be indented. | |
102 When this variable is non-nil, comment-only lines are indented | |
103 according to syntactic analysis via `c-offsets-alist', even when | |
104 \\[indent-for-comment] is used." | |
105 :type 'boolean | |
106 :group 'c) | |
107 | |
19298
4a99e63dc4a9
(c-buffer-is-cc-mode): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19255
diff
changeset
|
108 (defcustom c-comment-continuation-stars "* " |
4a99e63dc4a9
(c-buffer-is-cc-mode): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19255
diff
changeset
|
109 "*Specifies the leader of continued block comments. |
4a99e63dc4a9
(c-buffer-is-cc-mode): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19255
diff
changeset
|
110 You should set this variable to the literal string that gets inserted |
4a99e63dc4a9
(c-buffer-is-cc-mode): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19255
diff
changeset
|
111 at the front of continued block style comment lines. This should |
4a99e63dc4a9
(c-buffer-is-cc-mode): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19255
diff
changeset
|
112 either be the empty string, or some number of stars followed by a |
4a99e63dc4a9
(c-buffer-is-cc-mode): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19255
diff
changeset
|
113 single space. Note that for line style comments, this variable is not |
4a99e63dc4a9
(c-buffer-is-cc-mode): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19255
diff
changeset
|
114 used." |
4a99e63dc4a9
(c-buffer-is-cc-mode): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19255
diff
changeset
|
115 :type '(choice (const :tag "Use old semantics" nil) |
4a99e63dc4a9
(c-buffer-is-cc-mode): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19255
diff
changeset
|
116 string) |
4a99e63dc4a9
(c-buffer-is-cc-mode): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19255
diff
changeset
|
117 :group 'c) |
4a99e63dc4a9
(c-buffer-is-cc-mode): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19255
diff
changeset
|
118 |
18720 | 119 (defcustom c-cleanup-list '(scope-operator) |
120 "*List of various C/C++/ObjC constructs to \"clean up\". | |
121 These clean ups only take place when the auto-newline feature is | |
122 turned on, as evidenced by the `/a' or `/ah' appearing next to the | |
123 mode name. Valid symbols are: | |
124 | |
125 brace-else-brace -- cleans up `} else {' constructs by placing entire | |
126 construct on a single line. This clean up | |
127 only takes place when there is nothing but | |
128 white space between the braces and the `else'. | |
129 Clean up occurs when the open-brace after the | |
130 `else' is typed. | |
131 brace-elseif-brace -- similar to brace-else-brace, but cleans up | |
132 `} else if {' constructs. | |
133 empty-defun-braces -- cleans up empty defun braces by placing the | |
134 braces on the same line. Clean up occurs when | |
135 the defun closing brace is typed. | |
136 defun-close-semi -- cleans up the terminating semi-colon on defuns | |
137 by placing the semi-colon on the same line as | |
138 the closing brace. Clean up occurs when the | |
139 semi-colon is typed. | |
140 list-close-comma -- cleans up commas following braces in array | |
141 and aggregate initializers. Clean up occurs | |
142 when the comma is typed. | |
143 scope-operator -- cleans up double colons which may designate | |
144 a C++ scope operator split across multiple | |
145 lines. Note that certain C++ constructs can | |
146 generate ambiguous situations. This clean up | |
147 only takes place when there is nothing but | |
148 whitespace between colons. Clean up occurs | |
149 when the second colon is typed." | |
150 :type '(set | |
151 :extra-offset 8 | |
152 (const :tag "Put `} else {' on one line" brace-else-brace) | |
153 (const :tag "Put `} else if {' on one line" brace-elseif-brace) | |
154 (const :tag "Put empty defun braces on one line" empty-defun-braces) | |
155 (const :tag "Put `},' in aggregates on one line" list-close-comma) | |
156 (const :tag "Put C++ style `::' on one line" scope-operator)) | |
157 :group 'c) | |
158 | |
159 (defcustom c-hanging-braces-alist '((brace-list-open) | |
160 (substatement-open after) | |
161 (block-close . c-snug-do-while) | |
162 (extern-lang-open after) | |
163 ) | |
164 "*Controls the insertion of newlines before and after braces. | |
165 This variable contains an association list with elements of the | |
166 following form: (SYNTACTIC-SYMBOL . ACTION). | |
167 | |
168 When a brace (either opening or closing) is inserted, the syntactic | |
169 context it defines is looked up in this list, and if found, the | |
170 associated ACTION is used to determine where newlines are inserted. | |
171 If the context is not found, the default is to insert a newline both | |
172 before and after the brace. | |
173 | |
174 SYNTACTIC-SYMBOL can be any of: defun-open, defun-close, class-open, | |
175 class-close, inline-open, inline-close, block-open, block-close, | |
176 substatement-open, statement-case-open, extern-lang-open, | |
177 extern-lang-close, brace-list-open, brace-list-close, | |
178 brace-list-intro, or brace-list-entry. See `c-offsets-alist' for | |
179 details. | |
180 | |
181 ACTION can be either a function symbol or a list containing any | |
182 combination of the symbols `before' or `after'. If the list is empty, | |
183 no newlines are inserted either before or after the brace. | |
184 | |
185 When ACTION is a function symbol, the function is called with a two | |
186 arguments: the syntactic symbol for the brace and the buffer position | |
187 at which the brace was inserted. The function must return a list as | |
188 described in the preceding paragraph. Note that during the call to | |
189 the function, the variable `c-syntactic-context' is set to the entire | |
190 syntactic context for the brace line." | |
191 :type '(repeat | |
192 (cons :format "%v" | |
193 (choice :tag "Syntax" | |
194 (const defun-open) (const defun-close) | |
195 (const class-open) (const class-close) | |
196 (const inline-open) (const inline-close) | |
197 (const block-open) (const block-close) | |
198 (const substatement-open) (const statement-case-open) | |
199 (const extern-lang-open) (const extern-lang-close) | |
200 (const brace-list-open) (const brace-list-close) | |
201 (const brace-list-intro) (const brace-list-entry)) | |
202 (choice :tag "Action" | |
203 (set :format "Insert a newline %v" | |
204 :extra-offset 38 | |
205 (const :tag "before brace" before) | |
206 (const :tag "after brace" after)) | |
207 (function :format "Run function %v" :value c-) | |
208 ))) | |
209 :group 'c) | |
210 | |
211 (defcustom c-hanging-colons-alist nil | |
212 "*Controls the insertion of newlines before and after certain colons. | |
213 This variable contains an association list with elements of the | |
214 following form: (SYNTACTIC-SYMBOL . ACTION). | |
215 | |
216 SYNTACTIC-SYMBOL can be any of: case-label, label, access-label, | |
217 member-init-intro, or inher-intro. | |
218 | |
219 See the variable `c-hanging-braces-alist' for the semantics of this | |
220 variable. Note however that making ACTION a function symbol is | |
221 currently not supported for this variable." | |
222 :type '(repeat | |
223 (cons :format "%v" | |
224 (choice :tag "Syntax" | |
225 (const case-label) (const label) (const access-label) | |
226 (const member-init-intro) (const inher-intro)) | |
227 (set :tag "Action" | |
228 :format "%t: %v" | |
229 :extra-offset 8 | |
230 (const before) (const after)))) | |
231 :group 'c) | |
232 | |
233 (defcustom c-hanging-semi&comma-criteria '(c-semi&comma-inside-parenlist) | |
234 "*List of functions that decide whether to insert a newline or not. | |
235 The functions in this list are called, in order, whenever the | |
236 auto-newline minor mode is activated (as evidenced by a `/a' or `/ah' | |
237 string in the mode line), and a semicolon or comma is typed (see | |
238 `c-electric-semi&comma'). Each function in this list is called with | |
239 no arguments, and should return one of the following values: | |
240 | |
241 nil -- no determination made, continue checking | |
242 'stop -- do not insert a newline, and stop checking | |
243 (anything else) -- insert a newline, and stop checking | |
244 | |
245 If every function in the list is called with no determination made, | |
246 then no newline is inserted." | |
247 :type '(repeat function) | |
248 :group 'c) | |
249 | |
250 (defcustom c-hanging-comment-ender-p t | |
251 "*Controls what \\[fill-paragraph] does to C block comment enders. | |
252 When set to nil, C block comment enders are left on their own line. | |
253 When set to t, block comment enders will be placed at the end of the | |
254 previous line (i.e. they `hang' on that line)." | |
255 :type 'boolean | |
256 :group 'c) | |
257 | |
258 (defcustom c-hanging-comment-starter-p t | |
259 "*Controls what \\[fill-paragraph] does to C block comment starters. | |
260 When set to nil, C block comment starters are left on their own line. | |
261 When set to t, text that follows a block comment starter will be | |
262 placed on the same line as the block comment starter (i.e. the text | |
263 `hangs' on that line)." | |
264 :type 'boolean | |
265 :group 'c) | |
266 | |
267 (defcustom c-backslash-column 48 | |
268 "*Column to insert backslashes when macroizing a region." | |
269 :type 'integer | |
270 :group 'c) | |
271 | |
272 (defcustom c-special-indent-hook nil | |
273 "*Hook for user defined special indentation adjustments. | |
274 This hook gets called after a line is indented by the mode." | |
275 :type 'hook | |
276 :group 'c) | |
277 | |
278 (defcustom c-backspace-function 'backward-delete-char-untabify | |
279 "*Function called by `c-electric-backspace' when deleting backwards." | |
280 :type 'function | |
281 :group 'c) | |
282 | |
283 (defcustom c-delete-function 'delete-char | |
284 "*Function called by `c-electric-delete' when deleting forwards." | |
285 :type 'function | |
286 :group 'c) | |
287 | |
288 (defcustom c-electric-pound-behavior nil | |
289 "*List of behaviors for electric pound insertion. | |
290 Only currently supported behavior is `alignleft'." | |
291 :type '(set :extra-offset 8 (const alignleft)) | |
292 :group 'c) | |
293 | |
294 (defcustom c-label-minimum-indentation 1 | |
295 "*Minimum indentation for lines inside of top-level constructs. | |
296 This variable typically only affects code using the `gnu' style, which | |
297 mandates a minimum of one space in front of every line inside | |
298 top-level constructs. Specifically, the function | |
299 `c-gnu-impose-minimum' on your `c-special-indent-hook' is what | |
300 enforces this." | |
301 :type 'integer | |
302 :group 'c) | |
303 | |
304 (defcustom c-progress-interval 5 | |
305 "*Interval used to update progress status during long re-indentation. | |
306 If a number, percentage complete gets updated after each interval of | |
20144
56d81cc7b4f5
(c-progress-interval): Document new semantics
Karl Heuer <kwzh@gnu.org>
parents:
20140
diff
changeset
|
307 that many seconds. To inhibit all messages during indentation, set |
56d81cc7b4f5
(c-progress-interval): Document new semantics
Karl Heuer <kwzh@gnu.org>
parents:
20140
diff
changeset
|
308 this variable to nil." |
18720 | 309 :type 'integer |
310 :group 'c) | |
311 | |
20919
9cffecf3b1ca
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20144
diff
changeset
|
312 (defcustom c-default-style "gnu" |
9cffecf3b1ca
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20144
diff
changeset
|
313 "*Style which gets installed by default. |
9cffecf3b1ca
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20144
diff
changeset
|
314 |
9cffecf3b1ca
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20144
diff
changeset
|
315 The value of this variable can be any style defined in |
9cffecf3b1ca
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20144
diff
changeset
|
316 `c-style-alist', including styles you add, if you add them before CC |
9cffecf3b1ca
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20144
diff
changeset
|
317 Mode gets initialized. Note that if you set any CC Mode variables in |
9cffecf3b1ca
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20144
diff
changeset
|
318 the top-level of your .emacs file (i.e. *not* in a hook), these get |
9cffecf3b1ca
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20144
diff
changeset
|
319 incorporated into the `user' style so you would need to add: |
9cffecf3b1ca
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20144
diff
changeset
|
320 |
9cffecf3b1ca
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20144
diff
changeset
|
321 (setq c-default-style \"user\") |
9cffecf3b1ca
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20144
diff
changeset
|
322 |
9cffecf3b1ca
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20144
diff
changeset
|
323 to see your customizations. This is also true if you use the Custom |
9cffecf3b1ca
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20144
diff
changeset
|
324 interface -- be sure to set the default style to `user'." |
18720 | 325 :type 'string |
326 :group 'c) | |
327 | |
328 (defcustom c-style-variables-are-local-p nil | |
329 "*Whether style variables should be buffer local by default. | |
330 If non-nil, then all indentation style related variables will be made | |
331 buffer local by default. If nil, they will remain global. Variables | |
332 are made buffer local when this file is loaded, and once buffer | |
333 localized, they cannot be made global again. | |
334 | |
335 The list of variables to buffer localize are: | |
336 c-offsets-alist | |
337 c-basic-offset | |
338 c-file-style | |
339 c-file-offsets | |
340 c-comment-only-line-offset | |
341 c-cleanup-list | |
342 c-hanging-braces-alist | |
343 c-hanging-colons-alist | |
344 c-hanging-comment-starter-p | |
345 c-hanging-comment-ender-p | |
346 c-backslash-column | |
347 c-label-minimum-indentation | |
348 c-special-indent-hook | |
349 c-indentation-style" | |
350 :type 'boolean | |
351 :group 'c) | |
352 | |
353 (defcustom c-mode-hook nil | |
354 "*Hook called by `c-mode'." | |
355 :type '(hook :format "%{C Mode Hook%}:\n%v") | |
356 :group 'c) | |
357 | |
358 (defcustom c++-mode-hook nil | |
359 "*Hook called by `c++-mode'." | |
360 :type 'hook | |
361 :group 'c) | |
362 | |
363 (defcustom objc-mode-hook nil | |
364 "*Hook called by `objc-mode'." | |
365 :type 'hook | |
366 :group 'c) | |
367 | |
368 (defcustom java-mode-hook nil | |
369 "*Hook called by `java-mode'." | |
370 :type 'hook | |
371 :group 'c) | |
372 | |
19255
40a9475f22ea
(idl-mode-hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18848
diff
changeset
|
373 (defcustom idl-mode-hook nil |
40a9475f22ea
(idl-mode-hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18848
diff
changeset
|
374 "*Hook called by `idl-mode'." |
40a9475f22ea
(idl-mode-hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18848
diff
changeset
|
375 :type 'hook |
40a9475f22ea
(idl-mode-hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18848
diff
changeset
|
376 :group 'c) |
40a9475f22ea
(idl-mode-hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18848
diff
changeset
|
377 |
18720 | 378 (defcustom c-mode-common-hook nil |
379 "*Hook called by all CC Mode modes for common initializations." | |
380 :type '(hook :format "%{CC Mode Common Hook%}:\n%v") | |
381 :group 'c) | |
382 | |
19255
40a9475f22ea
(idl-mode-hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18848
diff
changeset
|
383 (defcustom c-initialization-hook nil |
40a9475f22ea
(idl-mode-hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18848
diff
changeset
|
384 "*Hook called when the CC Mode package gets initialized. |
40a9475f22ea
(idl-mode-hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18848
diff
changeset
|
385 This hook is only run once per Emacs session and can be used as a |
40a9475f22ea
(idl-mode-hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18848
diff
changeset
|
386 `load-hook' or in place of using `eval-after-load'." |
40a9475f22ea
(idl-mode-hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18848
diff
changeset
|
387 :type 'hook |
40a9475f22ea
(idl-mode-hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18848
diff
changeset
|
388 :group 'c) |
40a9475f22ea
(idl-mode-hook): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
18848
diff
changeset
|
389 |
20919
9cffecf3b1ca
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20144
diff
changeset
|
390 (defcustom c-enable-xemacs-performance-kludge-p t |
9cffecf3b1ca
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20144
diff
changeset
|
391 "*Enables a XEmacs only hack that may improve speed for some coding styles. |
9cffecf3b1ca
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20144
diff
changeset
|
392 For styles that hang top-level opening braces (as is common with JDK |
9cffecf3b1ca
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20144
diff
changeset
|
393 Java coding styles) this can improve performance between 3 and 60 |
9cffecf3b1ca
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20144
diff
changeset
|
394 times for core indentation functions (e.g. `c-parse-state'). For |
9cffecf3b1ca
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20144
diff
changeset
|
395 styles that conform to the Emacs recommendation of putting these |
9cffecf3b1ca
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20144
diff
changeset
|
396 braces in column zero, this may slightly degrade performance in some |
9cffecf3b1ca
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20144
diff
changeset
|
397 situations, but only by a few percentage points. This variable only |
9cffecf3b1ca
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20144
diff
changeset
|
398 has effect in XEmacs.") |
18720 | 399 |
400 | |
401 ;; Non-customizable variables, still part of the interface to CC Mode | |
402 (defvar c-file-style nil | |
403 "Variable interface for setting style via File Local Variables. | |
404 In a file's Local Variable section, you can set this variable to a | |
405 string suitable for `c-set-style'. When the file is visited, CC Mode | |
406 will set the style of the file to this value automatically. | |
407 | |
408 Note that file style settings are applied before file offset settings | |
409 as designated in the variable `c-file-offsets'.") | |
410 | |
411 (defvar c-file-offsets nil | |
412 "Variable interface for setting offsets via File Local Variables. | |
413 In a file's Local Variable section, you can set this variable to an | |
414 association list similar to the values allowed in `c-offsets-alist'. | |
415 When the file is visited, CC Mode will institute these offset settings | |
416 automatically. | |
417 | |
418 Note that file offset settings are applied after file style settings | |
419 as designated in the variable `c-file-style'.") | |
420 | |
421 (defvar c-syntactic-context nil | |
422 "Variable containing syntactic analysis list during indentation.") | |
423 | |
20919
9cffecf3b1ca
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20144
diff
changeset
|
424 (defvar c-indentation-style c-default-style |
18720 | 425 "Name of style installed in the current buffer.") |
426 | |
19298
4a99e63dc4a9
(c-buffer-is-cc-mode): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19255
diff
changeset
|
427 |
18720 | 428 |
21105
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
429 ;; Figure out what features this Emacs has |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
430 ;;;###autoload |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
431 (defconst c-emacs-features |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
432 (let ((infodock-p (boundp 'infodock-version)) |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
433 (comments |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
434 ;; XEmacs 19 and beyond use 8-bit modify-syntax-entry flags. |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
435 ;; Emacs 19 uses a 1-bit flag. We will have to set up our |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
436 ;; syntax tables differently to handle this. |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
437 (let ((table (copy-syntax-table)) |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
438 entry) |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
439 (modify-syntax-entry ?a ". 12345678" table) |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
440 (cond |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
441 ;; XEmacs 19, and beyond Emacs 19.34 |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
442 ((arrayp table) |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
443 (setq entry (aref table ?a)) |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
444 ;; In Emacs, table entries are cons cells |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
445 (if (consp entry) (setq entry (car entry)))) |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
446 ;; XEmacs 20 |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
447 ((fboundp 'get-char-table) (setq entry (get-char-table ?a table))) |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
448 ;; before and including Emacs 19.34 |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
449 ((and (fboundp 'char-table-p) |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
450 (char-table-p table)) |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
451 (setq entry (car (char-table-range table [?a])))) |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
452 ;; incompatible |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
453 (t (error "CC Mode is incompatible with this version of Emacs"))) |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
454 (if (= (logand (lsh entry -16) 255) 255) |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
455 '8-bit |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
456 '1-bit)))) |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
457 (if infodock-p |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
458 (list comments 'infodock) |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
459 (list comments))) |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
460 "A list of features extant in the Emacs you are using. |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
461 There are many flavors of Emacs out there, each with different |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
462 features supporting those needed by CC Mode. Here's the current |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
463 supported list, along with the values for this variable: |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
464 |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
465 XEmacs 19: (8-bit) |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
466 XEmacs 20: (8-bit) |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
467 Emacs 19: (1-bit) |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
468 |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
469 Infodock (based on XEmacs) has an additional symbol on this list: |
21111
dad4e4facdc0
(c-emacs-features): Var moved from cc-defs.el.
Richard M. Stallman <rms@gnu.org>
parents:
21105
diff
changeset
|
470 `infodock'.") |
21105
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
471 |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
472 |
b40ae72a5b26
(c-enable-xemacs-performance-kludge-p): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
20919
diff
changeset
|
473 |
18720 | 474 (provide 'cc-vars) |
475 ;;; cc-vars.el ends here |