]> code.delx.au - gnu-emacs/blob - lisp/progmodes/cc-vars.el
Merge from emacs-24; up to 117634
[gnu-emacs] / lisp / progmodes / cc-vars.el
1 ;;; cc-vars.el --- user customization variables for CC Mode
2
3 ;; Copyright (C) 1985, 1987, 1992-2014 Free Software Foundation, Inc.
4
5 ;; Authors: 2002- Alan Mackenzie
6 ;; 1998- Martin Stjernholm
7 ;; 1992-1999 Barry A. Warsaw
8 ;; 1987 Dave Detlefs
9 ;; 1987 Stewart Clamen
10 ;; 1985 Richard M. Stallman
11 ;; Maintainer: bug-cc-mode@gnu.org
12 ;; Created: 22-Apr-1997 (split from cc-mode.el)
13 ;; Keywords: c languages
14 ;; Package: cc-mode
15
16 ;; This file is part of GNU Emacs.
17
18 ;; GNU Emacs is free software: you can redistribute it and/or modify
19 ;; it under the terms of the GNU General Public License as published by
20 ;; the Free Software Foundation, either version 3 of the License, or
21 ;; (at your option) any later version.
22
23 ;; GNU Emacs is distributed in the hope that it will be useful,
24 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
25 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 ;; GNU General Public License for more details.
27
28 ;; You should have received a copy of the GNU General Public License
29 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
30
31 ;;; Commentary:
32
33 ;;; Code:
34
35 (eval-when-compile
36 (let ((load-path
37 (if (and (boundp 'byte-compile-dest-file)
38 (stringp byte-compile-dest-file))
39 (cons (file-name-directory byte-compile-dest-file) load-path)
40 load-path)))
41 (load "cc-bytecomp" nil t)))
42
43 (cc-require 'cc-defs)
44
45 (cc-eval-when-compile
46 (require 'custom)
47 (require 'widget))
48
49 ;;; Helpers
50
51
52 ;; Emacs has 'other since at least version 21.1.
53 ;; FIXME this is probably broken, since the widget is defined
54 ;; in wid-edit, which this file does not load. So we will always
55 ;; define the widget, even when we don't need to.
56 (when (featurep 'xemacs)
57 (or (get 'other 'widget-type)
58 (define-widget 'other 'sexp
59 "Matches everything, but doesn't let the user edit the value.
60 Useful as last item in a `choice' widget."
61 :tag "Other"
62 :format "%t%n"
63 :value 'other)))
64
65 ;; The next defun will supersede c-const-symbol.
66 (eval-and-compile
67 (defun c-constant-symbol (sym len)
68 "Create an uneditable symbol for customization buffers.
69 SYM is the name of the symbol, LEN the length of the field (in
70 characters) the symbol will be displayed in. LEN must be big
71 enough.
72
73 This returns a (const ....) structure, suitable for embedding
74 within a customization type."
75 (or (symbolp sym) (error "c-constant-symbol: %s is not a symbol" sym))
76 (let* ((name (symbol-name sym))
77 (l (length name))
78 (disp (concat name ":" (make-string (- len l 1) ?\ ))))
79 `(const
80 :size ,len
81 :format ,disp
82 :value ,sym))))
83
84 (define-widget 'c-const-symbol 'item
85 "An uneditable lisp symbol. This is obsolete -
86 use c-constant-symbol instead."
87 :value nil
88 :tag "Symbol"
89 :format "%t: %v\n%d"
90 :match (lambda (widget value) (symbolp value))
91 :value-to-internal
92 (lambda (widget value)
93 (let ((s (if (symbolp value)
94 (symbol-name value)
95 value))
96 (l (widget-get widget :size)))
97 (if l
98 (setq s (concat s (make-string (- l (length s)) ?\ ))))
99 s))
100 :value-to-external
101 (lambda (widget value)
102 (if (stringp value)
103 (intern (progn
104 (string-match "\\`[^ ]*" value)
105 (match-string 0 value)))
106 value)))
107
108 (define-widget 'c-integer-or-nil 'sexp
109 "An integer or the value nil."
110 :value nil
111 :tag "Optional integer"
112 :match (lambda (widget value) (or (integerp value) (null value))))
113
114 (define-widget 'c-symbol-list 'sexp
115 "A single symbol or a list of symbols."
116 :tag "Symbols separated by spaces"
117 :validate 'widget-field-validate
118 :match
119 (lambda (widget value)
120 (or (symbolp value)
121 (catch 'ok
122 (while (listp value)
123 (unless (symbolp (car value))
124 (throw 'ok nil))
125 (setq value (cdr value)))
126 (null value))))
127 :value-to-internal
128 (lambda (widget value)
129 (cond ((null value)
130 "")
131 ((symbolp value)
132 (symbol-name value))
133 ((consp value)
134 (mapconcat (lambda (symbol)
135 (symbol-name symbol))
136 value
137 " "))
138 (t
139 value)))
140 :value-to-external
141 (lambda (widget value)
142 (if (stringp value)
143 (let (list end)
144 (while (string-match "\\S +" value end)
145 (setq list (cons (intern (match-string 0 value)) list)
146 end (match-end 0)))
147 (if (and list (not (cdr list)))
148 (car list)
149 (nreverse list)))
150 value)))
151
152 (defvar c-style-variables
153 '(c-basic-offset c-comment-only-line-offset c-indent-comment-alist
154 c-indent-comments-syntactically-p c-block-comment-prefix
155 c-comment-prefix-regexp c-doc-comment-style c-cleanup-list
156 c-hanging-braces-alist c-hanging-colons-alist
157 c-hanging-semi&comma-criteria c-backslash-column c-backslash-max-column
158 c-special-indent-hook c-label-minimum-indentation c-offsets-alist)
159 "List of the style variables.")
160
161 (defvar c-fallback-style nil)
162
163 (defsubst c-set-stylevar-fallback (name val)
164 (put name 'c-stylevar-fallback val)
165 (setq c-fallback-style (cons (cons name val) c-fallback-style)))
166
167 (defmacro defcustom-c-stylevar (name val doc &rest args)
168 "Define a style variable NAME with VAL and DOC.
169 More precisely, convert the given `:type FOO', mined out of ARGS,
170 to an aggregate `:type (radio STYLE (PREAMBLE FOO))', append some
171 some boilerplate documentation to DOC, arrange for the fallback
172 value of NAME to be VAL, and call `custom-declare-variable' to
173 do the rest of the work.
174
175 STYLE stands for the choice where the value is taken from some
176 style setting. PREAMBLE is optionally prepended to FOO; that is,
177 if FOO contains :tag or :value, the respective two-element list
178 component is ignored."
179 (declare (debug (symbolp form stringp &rest)))
180 (let* ((expanded-doc (concat doc "
181
182 This is a style variable. Apart from the valid values described
183 above, it can be set to the symbol `set-from-style'. In that case,
184 it takes its value from the style system (see `c-default-style' and
185 `c-style-alist') when a CC Mode buffer is initialized. Otherwise,
186 the value set here overrides the style system (there is a variable
187 `c-old-style-variable-behavior' that changes this, though)."))
188 (typ (eval (plist-get args :type)))
189 (type (if (consp typ) typ (list typ)))
190 (head (car type))
191 (tail (cdr type))
192 (newt (append (unless (plist-get tail :tag)
193 '(:tag "Override style settings"))
194 (unless (plist-get tail :value)
195 `(:value ,(eval val)))
196 tail))
197 (aggregate `'(radio
198 (const :tag "Use style settings" set-from-style)
199 ,(cons head newt))))
200 `(progn
201 (c-set-stylevar-fallback ',name ,val)
202 (custom-declare-variable
203 ',name ''set-from-style
204 ,expanded-doc
205 ,@(plist-put args :type aggregate)))))
206
207 (defun c-valid-offset (offset)
208 "Return non-nil if OFFSET is a valid offset for a syntactic symbol.
209 See `c-offsets-alist'."
210 (or (eq offset '+)
211 (eq offset '-)
212 (eq offset '++)
213 (eq offset '--)
214 (eq offset '*)
215 (eq offset '/)
216 (integerp offset)
217 (functionp offset)
218 (and (symbolp offset) (boundp offset))
219 (and (vectorp offset)
220 (= (length offset) 1)
221 (integerp (elt offset 0)))
222 (and (consp offset)
223 (not (eq (car offset) 'quote)) ; Detect misquoted lists.
224 (progn
225 (when (memq (car offset) '(first min max add))
226 (setq offset (cdr offset)))
227 (while (and (consp offset)
228 (c-valid-offset (car offset)))
229 (setq offset (cdr offset)))
230 (null offset)))))
231
232
233 \f
234 ;;; User variables
235
236 (defcustom c-strict-syntax-p nil
237 "*If non-nil, all syntactic symbols must be found in `c-offsets-alist'.
238 If the syntactic symbol for a particular line does not match a symbol
239 in the offsets alist, or if no non-nil offset value can be determined
240 for a symbol, an error is generated, otherwise no error is reported
241 and the syntactic symbol is ignored.
242
243 This variable is considered obsolete; it doesn't work well with lineup
244 functions that return nil to support the feature of using lists on
245 syntactic symbols in `c-offsets-alist'. Please keep it set to nil."
246 :type 'boolean
247 :group 'c)
248
249 (defcustom c-echo-syntactic-information-p nil
250 "*If non-nil, syntactic info is echoed when the line is indented."
251 :type 'boolean
252 :group 'c)
253
254 (defcustom c-report-syntactic-errors nil
255 "*If non-nil, certain syntactic errors are reported with a ding
256 and a message, for example when an \"else\" is indented for which
257 there's no corresponding \"if\".
258
259 Note however that CC Mode doesn't make any special effort to check for
260 syntactic errors; that's the job of the compiler. The reason it can
261 report cases like the one above is that it can't find the correct
262 anchoring position to indent the line in that case."
263 :type 'boolean
264 :group 'c)
265
266 (defcustom-c-stylevar c-basic-offset 4
267 "*Amount of basic offset used by + and - symbols in `c-offsets-alist'.
268 Also used as the indentation step when `c-syntactic-indentation' is
269 nil."
270 :type 'integer
271 :group 'c)
272 ;;;###autoload(put 'c-basic-offset 'safe-local-variable 'integerp)
273
274 (defcustom c-tab-always-indent t
275 "*Controls the operation of the TAB key.
276 If t, hitting TAB always just indents the current line. If nil, hitting
277 TAB indents the current line if point is at the left margin or in the
278 line's indentation, otherwise it inserts a `real' tab character \(see
279 note\). If some other value (not nil or t), then tab is inserted only
280 within literals \(comments and strings), but the line is always
281 reindented.
282
283 Note: The value of `indent-tabs-mode' will determine whether a real
284 tab character will be inserted, or the equivalent number of spaces.
285 When inserting a tab, actually the function stored in the variable
286 `c-insert-tab-function' is called.
287
288 Note: indentation of lines containing only comments is also controlled
289 by the `c-comment-only-line-offset' variable."
290 :type '(radio
291 (const :tag "TAB key always indents, never inserts TAB" t)
292 (const :tag "TAB key indents in left margin, otherwise inserts TAB" nil)
293 (other :tag "TAB key inserts TAB in literals, otherwise indents" other))
294 :group 'c)
295
296 (defcustom c-insert-tab-function 'insert-tab
297 "*Function used when inserting a tab for \\[c-indent-command].
298 Only used when `c-tab-always-indent' indicates a `real' tab character
299 should be inserted. Value must be a function taking no arguments.
300 The default, `insert-tab', inserts either a tab or the equivalent
301 number of spaces depending on the value of `indent-tabs-mode'."
302 :type 'function
303 :group 'c)
304
305 (defcustom c-syntactic-indentation t
306 "*Whether the indentation should be controlled by the syntactic context.
307
308 If t, the indentation functions indent according to the syntactic
309 context, using the style settings specified by `c-offsets-alist'.
310
311 If nil, every line is just indented to the same level as the previous
312 one, and the \\[c-indent-command] command adjusts the indentation in
313 steps specified by `c-basic-offset'. The indentation style has no
314 effect in this mode, nor any of the indentation associated variables,
315 e.g. `c-special-indent-hook'."
316 :type 'boolean
317 :group 'c)
318 (make-variable-buffer-local 'c-syntactic-indentation)
319 (put 'c-syntactic-indentation 'safe-local-variable 'booleanp)
320
321 (defcustom c-syntactic-indentation-in-macros t
322 "*Enable syntactic analysis inside macros.
323 If this is nil, all lines inside macro definitions are analyzed as
324 `cpp-macro-cont'. Otherwise they are analyzed syntactically, just
325 like normal code, and `cpp-define-intro' is used to create the
326 additional indentation of the bodies of \"#define\" macros.
327
328 Having this enabled simplifies editing of large multiline macros, but
329 it might complicate editing if CC Mode doesn't recognize the context
330 of the macro content. The default context inside the macro is the
331 same as the top level, so if it contains \"bare\" statements they
332 might be indented wrongly, although there are special cases that
333 handle this in most cases. If this problem occurs, it's usually
334 countered easily by surrounding the statements by a block \(or even
335 better with the \"do { ... } while \(0)\" trick)."
336 :type 'boolean
337 :group 'c)
338 (put 'c-syntactic-indentation-in-macros 'safe-local-variable 'booleanp)
339
340 (defcustom c-defun-tactic 'go-outward
341 "*Whether functions are recognized inside, e.g., a class.
342 This is used by `c-beginning-of-defun' and like functions.
343
344 Its value is one of:
345 t -- Functions are recognized only at the top level.
346 go-outward -- Nested functions are also recognized. Should a function
347 command hit the beginning/end of a nested scope, it will
348 carry on at the less nested level."
349 :version "24.1"
350 :type '(radio
351 (const :tag "Functions are at the top-level" t)
352 (const :tag "Functions are also recognized inside declaration scopes" go-outward))
353 :group 'c)
354
355 (defcustom-c-stylevar c-comment-only-line-offset 0
356 "*Extra offset for line which contains only the start of a comment.
357 Can contain an integer or a cons cell of the form:
358
359 (NON-ANCHORED-OFFSET . ANCHORED-OFFSET)
360
361 Where NON-ANCHORED-OFFSET is the amount of offset given to
362 non-column-zero anchored comment-only lines, and ANCHORED-OFFSET is
363 the amount of offset to give column-zero anchored comment-only lines.
364 Just an integer as value is equivalent to (<val> . -1000).
365
366 Note that this variable only has effect when the `c-lineup-comment'
367 lineup function is used on the `comment-intro' syntactic symbol (the
368 default)."
369 :type '(choice (integer :tag "Non-anchored offset" 0)
370 (cons :tag "Non-anchored & anchored offset"
371 :value (0 . 0)
372 (integer :tag "Non-anchored offset")
373 (integer :tag "Anchored offset")))
374 :group 'c)
375
376 (defcustom-c-stylevar c-indent-comment-alist
377 '((anchored-comment . (column . 0))
378 (end-block . (space . 1))
379 (cpp-end-block . (space . 2)))
380 "*Specifies how \\[indent-for-comment] calculates the comment start column.
381 This is an association list that contains entries of the form:
382
383 (LINE-TYPE . INDENT-SPEC)
384
385 LINE-TYPE specifies a type of line as described below, and INDENT-SPEC
386 says what \\[indent-for-comment] should do when used on that type of line.
387
388 The recognized values for LINE-TYPE are:
389
390 empty-line -- The line is empty.
391 anchored-comment -- The line contains a comment that starts in column 0.
392 end-block -- The line contains a solitary block closing brace.
393 cpp-end-block -- The line contains a preprocessor directive that
394 closes a block, i.e. either \"#endif\" or \"#else\".
395 other -- The line does not match any other entry
396 currently on the list.
397
398 An INDENT-SPEC is a cons cell of the form:
399
400 (ACTION . VALUE)
401
402 ACTION says how \\[indent-for-comment] should align the comment, and
403 VALUE is interpreted depending on ACTION. ACTION can be any of the
404 following:
405
406 space -- Put VALUE spaces between the end of the line and the start
407 of the comment.
408 column -- Start the comment at the column VALUE. If the line is
409 longer than that, the comment is preceded by a single
410 space. If VALUE is nil, `comment-column' is used.
411 align -- Align the comment with one on the previous line, if there
412 is any. If the line is too long, the comment is preceded
413 by a single space. If there isn't a comment start on the
414 previous line, the behavior is specified by VALUE, which
415 in turn is interpreted as an INDENT-SPEC.
416
417 If a LINE-TYPE is missing, then \\[indent-for-comment] indents the comment
418 according to `comment-column'.
419
420 Note that a non-nil value on `c-indent-comments-syntactically-p'
421 overrides this variable, so empty lines are indented syntactically
422 in that case, i.e. as if \\[c-indent-command] was used instead."
423 :type
424 (let ((space '(cons :tag "space"
425 :format "%v"
426 :value (space . 1)
427 (const :format "space " space)
428 (integer :format "%v")))
429 (column '(cons :tag "column"
430 :format "%v"
431 (const :format "column " column)
432 (c-integer-or-nil :format "%v"))))
433 `(set ,@(mapcar
434 (lambda (elt)
435 `(cons :format "%v"
436 ,(c-constant-symbol elt 20)
437 (choice
438 :format "%[Choice%] %v"
439 :value (column . nil)
440 ,space
441 ,column
442 (cons :tag "align"
443 :format "%v"
444 (const :format "align " align)
445 (choice
446 :format "%[Choice%] %v"
447 :value (column . nil)
448 ,space
449 ,column)))))
450 '(empty-line anchored-comment end-block cpp-end-block other))))
451 :group 'c)
452
453 (defcustom-c-stylevar c-indent-comments-syntactically-p nil
454 "*Specifies how \\[indent-for-comment] should handle comment-only lines.
455 When this variable is non-nil, comment-only lines are indented
456 according to syntactic analysis via `c-offsets-alist'. Otherwise, the
457 comment is indented as if it was preceded by code. Note that this
458 variable does not affect how the normal line indentation treats
459 comment-only lines."
460 :type 'boolean
461 :group 'c)
462
463 (make-obsolete-variable 'c-comment-continuation-stars
464 'c-block-comment-prefix "21.1")
465
466 ;; Although c-comment-continuation-stars is obsolete, we look at it in
467 ;; some places in CC Mode anyway, so make the compiler ignore it
468 ;; during our compilation.
469 ;; [This is unclean; better to use `symbol-value'. --ttn]
470 ;;(cc-bytecomp-obsolete-var c-comment-continuation-stars)
471 ;;(cc-bytecomp-defvar c-comment-continuation-stars)
472
473 (defcustom-c-stylevar c-block-comment-prefix
474 (if (boundp 'c-comment-continuation-stars)
475 (symbol-value 'c-comment-continuation-stars)
476 "* ")
477 "*Specifies the line prefix of continued C-style block comments.
478 You should set this variable to the literal string that gets inserted
479 at the front of continued block style comment lines. This should
480 either be the empty string, or some characters without preceding
481 spaces. To adjust the alignment under the comment starter, put an
482 appropriate value on the `c' syntactic symbol (see the
483 `c-offsets-alist' variable).
484
485 It's only used when a one-line block comment is broken into two or
486 more lines for the first time; otherwise the appropriate prefix is
487 adapted from the comment. This variable is not used for C++ line
488 style comments."
489 :type 'string
490 :group 'c)
491
492 (defcustom-c-stylevar c-comment-prefix-regexp
493 '((pike-mode . "//+!?\\|\\**")
494 (awk-mode . "#+")
495 (other . "//+\\|\\**"))
496 "*Regexp to match the line prefix inside comments.
497 This regexp is used to recognize the fill prefix inside comments for
498 correct paragraph filling and other things.
499
500 If this variable is a string, it will be used in all CC Mode major
501 modes. It can also be an association list, to associate specific
502 regexps to specific major modes. The symbol for the major mode is
503 looked up in the association list, and its value is used as the line
504 prefix regexp. If it's not found, then the symbol `other' is looked
505 up and its value is used instead.
506
507 The regexp should match the prefix used in both C++ style line
508 comments and C style block comments, but it does not need to match a
509 block comment starter. In other words, it should at least match
510 \"//\" for line comments and the string in `c-block-comment-prefix',
511 which is sometimes inserted by CC Mode inside block comments. It
512 should not match any surrounding whitespace.
513
514 Note that CC Mode uses this variable to set many other variables that
515 handle the paragraph filling. That's done at mode initialization or
516 when you switch to a style which sets this variable. Thus, if you
517 change it in some other way, e.g. interactively in a CC Mode buffer,
518 you will need to do \\[c-setup-paragraph-variables] afterwards so that
519 the other variables are updated with the new value.
520
521 Note also that when CC Mode starts up, all variables are initialized
522 before the mode hooks are run. It's therefore necessary to make a
523 call to `c-setup-paragraph-variables' explicitly if you change this
524 variable in a mode hook."
525 :type '(radio
526 (regexp :tag "Regexp for all modes")
527 (list
528 :tag "Mode-specific regexps"
529 (set
530 :inline t :format "%v"
531 (cons :format "%v"
532 (const :format "C " c-mode) (regexp :format "%v"))
533 (cons :format "%v"
534 (const :format "C++ " c++-mode) (regexp :format "%v"))
535 (cons :format "%v"
536 (const :format "ObjC " objc-mode) (regexp :format "%v"))
537 (cons :format "%v"
538 (const :format "Java " java-mode) (regexp :format "%v"))
539 (cons :format "%v"
540 (const :format "IDL " idl-mode) (regexp :format "%v"))
541 (cons :format "%v"
542 (const :format "Pike " pike-mode) (regexp :format "%v"))
543 (cons :format "%v"
544 (const :format "AWK " awk-mode) (regexp :format "%v")))
545 (cons :format " %v"
546 (const :format "Other " other) (regexp :format "%v"))))
547 :group 'c)
548
549 (defcustom-c-stylevar c-doc-comment-style
550 '((java-mode . javadoc)
551 (pike-mode . autodoc)
552 (c-mode . gtkdoc))
553 "*Specifies documentation comment style(s) to recognize.
554 This is primarily used to fontify doc comments and the markup within
555 them, e.g. Javadoc comments.
556
557 The value can be any of the following symbols for various known doc
558 comment styles:
559
560 javadoc -- Javadoc style for \"/** ... */\" comments (default in Java mode).
561 autodoc -- Pike autodoc style for \"//! ...\" comments (default in Pike mode).
562 gtkdoc -- GtkDoc style for \"/** ... **/\" comments (default in C mode).
563
564 The value may also be a list of doc comment styles, in which case all
565 of them are recognized simultaneously (presumably with markup cues
566 that don't conflict).
567
568 The value may also be an association list to specify different doc
569 comment styles for different languages. The symbol for the major mode
570 is then looked up in the alist, and the value of that element is
571 interpreted as above if found. If it isn't found then the symbol
572 `other' is looked up and its value is used instead.
573
574 Note that CC Mode uses this variable to set other variables that
575 handle fontification etc. That's done at mode initialization or when
576 you switch to a style which sets this variable. Thus, if you change
577 it in some other way, e.g. interactively in a CC Mode buffer, you will
578 need to do \\[java-mode] (or whatever mode you're currently using) to
579 reinitialize.
580
581 Note also that when CC Mode starts up, the other variables are
582 modified before the mode hooks are run. If you change this variable
583 in a mode hook, you have to call `c-setup-doc-comment-style'
584 afterwards to redo that work."
585 ;; Symbols other than those documented above may be used on this
586 ;; variable. If a variable exists that has that name with
587 ;; "-font-lock-keywords" appended, its value is prepended to the
588 ;; font lock keywords list. If it's a function then it's called and
589 ;; the result is prepended.
590 :type '(radio
591 (c-symbol-list :tag "Doc style(s) in all modes")
592 (list
593 :tag "Mode-specific doc styles"
594 (set
595 :inline t :format "%v"
596 (cons :format "%v"
597 (const :format "C " c-mode)
598 (c-symbol-list :format "%v"))
599 (cons :format "%v"
600 (const :format "C++ " c++-mode)
601 (c-symbol-list :format "%v"))
602 (cons :format "%v"
603 (const :format "ObjC " objc-mode)
604 (c-symbol-list :format "%v"))
605 (cons :format "%v"
606 (const :format "Java " java-mode)
607 (c-symbol-list :format "%v"))
608 (cons :format "%v"
609 (const :format "IDL " idl-mode)
610 (c-symbol-list :format "%v"))
611 (cons :format "%v"
612 (const :format "Pike " pike-mode)
613 (c-symbol-list :format "%v"))
614 (cons :format "%v"
615 (const :format "AWK " awk-mode)
616 (c-symbol-list :format "%v"))
617 (cons :format "%v"
618 (const :format "Other " other)
619 (c-symbol-list :format "%v")))))
620 :group 'c)
621
622 (defcustom c-ignore-auto-fill '(string cpp code)
623 "*List of contexts in which automatic filling never occurs.
624 If Auto Fill mode is active, it will be temporarily disabled if point
625 is in any context on this list. It's e.g. useful to enable Auto Fill
626 in comments only, but not in strings or normal code. The valid
627 contexts are:
628
629 string -- inside a string or character literal
630 c -- inside a C style block comment
631 c++ -- inside a C++ style line comment
632 cpp -- inside a preprocessor directive
633 code -- anywhere else, i.e. in normal code"
634 :type '(set
635 (const :tag "String literals" string)
636 (const :tag "C style block comments" c)
637 (const :tag "C++ style line comments" c++)
638 (const :tag "Preprocessor directives" cpp)
639 (const :tag "Normal code" code))
640 :group 'c)
641
642 (defcustom-c-stylevar c-cleanup-list '(scope-operator)
643 "*List of various C/C++/ObjC constructs to \"clean up\".
644 The following clean ups only take place when the auto-newline feature
645 is turned on, as evidenced by the `/la' appearing next to the mode
646 name:
647
648 brace-else-brace -- Clean up \"} else {\" constructs by placing
649 entire construct on a single line. This clean
650 up only takes place when there is nothing but
651 white space between the braces and the `else'.
652 Clean up occurs when the open brace after the
653 `else' is typed.
654 brace-elseif-brace -- Similar to brace-else-brace, but clean up
655 \"} else if (...) {\" constructs. Clean up
656 occurs after the open parenthesis and the open
657 brace.
658 brace-catch-brace -- Similar to brace-elseif-brace, but clean up
659 \"} catch (...) {\" constructs.
660 empty-defun-braces -- Clean up empty defun braces by placing the
661 braces on the same line. Clean up occurs when
662 the defun closing brace is typed.
663 one-liner-defun -- If the code inside a function body can fit in
664 a single line, then remove any newlines
665 between that line and the defun braces so that
666 the whole body becomes a single line.
667 `c-max-one-liner-length' gives the maximum
668 length allowed for the resulting line. Clean
669 up occurs when the closing brace is typed.
670 defun-close-semi -- Clean up the terminating semi-colon on defuns
671 by placing the semi-colon on the same line as
672 the closing brace. Clean up occurs when the
673 semi-colon is typed.
674 list-close-comma -- Clean up commas following braces in array
675 and aggregate initializers. Clean up occurs
676 when the comma is typed.
677 scope-operator -- Clean up double colons which may designate
678 a C++ scope operator split across multiple
679 lines. Note that certain C++ constructs can
680 generate ambiguous situations. This clean up
681 only takes place when there is nothing but
682 whitespace between colons. Clean up occurs
683 when the second colon is typed.
684
685 The following clean ups always take place when they are on this list,
686 regardless of the auto-newline feature, since they typically don't
687 involve auto-newline inserted newlines:
688
689 space-before-funcall -- Insert exactly one space before the opening
690 parenthesis of a function call. Clean up
691 occurs when the opening parenthesis is typed.
692 compact-empty-funcall -- Clean up any space before the function call
693 opening parenthesis if and only if the
694 argument list is empty. This is typically
695 useful together with `space-before-funcall' to
696 get the style \"foo (bar)\" and \"foo()\".
697 Clean up occurs when the closing parenthesis
698 is typed.
699 comment-close-slash -- When a slash is typed after the comment prefix
700 on a bare line in a c-style comment, the comment
701 is closed by cleaning up preceding space and
702 inserting a star if needed."
703 :type '(set
704 (const :tag "Put \"} else {\" on one line (brace-else-brace)"
705 brace-else-brace)
706 (const :tag "Put \"} else if (...) {\" on one line (brace-elseif-brace)"
707 brace-elseif-brace)
708 (const :tag "Put \"} catch (...) {\" on one line (brace-catch-brace)"
709 brace-catch-brace)
710 (const :tag "Put empty defun braces on one line (empty-defun-braces)"
711 empty-defun-braces)
712 (const :tag "Put short function bodies on one line (one-liner-defun)"
713 one-liner-defun)
714 (const :tag "Put \"};\" ending defuns on one line (defun-close-semi)"
715 defun-close-semi)
716 (const :tag "Put \"},\" in aggregates on one line (list-close-comma)"
717 list-close-comma)
718 (const :tag "Put C++ style \"::\" on one line (scope-operator)"
719 scope-operator)
720 (const :tag "Put a space before funcall parens, e.g. \"foo (bar)\" (space-before-funcall)"
721 space-before-funcall)
722 (const :tag "Remove space before empty funcalls, e.g. \"foo()\" (compact-empty-funcall)"
723 compact-empty-funcall)
724 (const :tag "Make / on a bare line of a C-style comment close it (comment-close-slash)"
725 comment-close-slash))
726 :group 'c)
727
728 (defcustom-c-stylevar c-hanging-braces-alist '((brace-list-open)
729 (brace-entry-open)
730 (statement-cont)
731 (substatement-open after)
732 (block-close . c-snug-do-while)
733 (extern-lang-open after)
734 (namespace-open after)
735 (module-open after)
736 (composition-open after)
737 (inexpr-class-open after)
738 (inexpr-class-close before)
739 (arglist-cont-nonempty))
740 "*Controls the insertion of newlines before and after braces
741 when the auto-newline feature is active. This variable contains an
742 association list with elements of the following form:
743 \(SYNTACTIC-SYMBOL . ACTION).
744
745 When a brace (either opening or closing) is inserted, the syntactic
746 context it defines is looked up in this list, and if found, the
747 associated ACTION is used to determine where newlines are inserted.
748 If the context is not found, the default is to insert a newline both
749 before and after the brace.
750
751 SYNTACTIC-SYMBOL can be statement-cont, brace-list-intro,
752 inexpr-class-open, inexpr-class-close, and any of the *-open and
753 *-close symbols. See `c-offsets-alist' for details, except for
754 inexpr-class-open and inexpr-class-close, which doesn't have any
755 corresponding symbols there. Those two symbols are used for the
756 opening and closing braces, respectively, of anonymous inner classes
757 in Java.
758
759 ACTION can be either a function symbol or a list containing any
760 combination of the symbols `before' or `after'. If the list is empty,
761 no newlines are inserted either before or after the brace.
762
763 When ACTION is a function symbol, the function is called with a two
764 arguments: the syntactic symbol for the brace and the buffer position
765 at which the brace was inserted. The function must return a list as
766 described in the preceding paragraph. Note that during the call to
767 the function, the variable `c-syntactic-context' is set to the entire
768 syntactic context for the brace line."
769 :type
770 `(set ,@(mapcar
771 (lambda (elt)
772 `(cons :format "%v"
773 ,(c-constant-symbol elt 24)
774 (choice :format "%[Choice%] %v"
775 :value (before after)
776 (set :menu-tag "Before/after"
777 :format "Newline %v brace\n"
778 (const :format "%v, " before)
779 (const :format "%v " after))
780 (function :menu-tag "Function"
781 :format "Run function: %v"))))
782 '(defun-open defun-close
783 class-open class-close
784 inline-open inline-close
785 block-open block-close
786 statement-cont substatement-open statement-case-open
787 brace-list-open brace-list-close
788 brace-list-intro brace-entry-open
789 extern-lang-open extern-lang-close
790 namespace-open namespace-close
791 module-open module-close
792 composition-open composition-close
793 inexpr-class-open inexpr-class-close
794 arglist-cont-nonempty)))
795 :group 'c)
796
797 (defcustom c-max-one-liner-length 80
798 "Maximum length of line that clean-up \"one-liner-defun\" will compact to.
799 Zero or nil means no limit."
800 :type 'integer
801 :group 'c)
802
803 (defcustom-c-stylevar c-hanging-colons-alist nil
804 "*Controls the insertion of newlines before and after certain colons.
805 This variable contains an association list with elements of the
806 following form: (SYNTACTIC-SYMBOL . ACTION).
807
808 SYNTACTIC-SYMBOL can be any of: case-label, label, access-label,
809 member-init-intro, or inher-intro.
810
811 See the variable `c-hanging-braces-alist' for the semantics of this
812 variable. Note however that making ACTION a function symbol is
813 currently not supported for this variable."
814 :type
815 `(set ,@(mapcar
816 (lambda (elt)
817 `(cons :format "%v"
818 ,(c-constant-symbol elt 20)
819 (set :format "Newline %v colon\n"
820 (const :format "%v, " before)
821 (const :format "%v" after))))
822 '(case-label label access-label member-init-intro inher-intro)))
823 :group 'c)
824
825 (defcustom-c-stylevar c-hanging-semi&comma-criteria
826 '(c-semi&comma-inside-parenlist)
827 "*List of functions that decide whether to insert a newline or not.
828 The functions in this list are called, in order, whenever the
829 auto-newline minor mode is activated (as evidenced by a `/a' or `/ah'
830 string in the mode line), and a semicolon or comma is typed (see
831 `c-electric-semi&comma'). Each function in this list is called with
832 no arguments, and should return one of the following values:
833
834 nil -- no determination made, continue checking
835 'stop -- do not insert a newline, and stop checking
836 (anything else) -- insert a newline, and stop checking
837
838 If every function in the list is called with no determination made,
839 then no newline is inserted."
840 :type '(repeat function)
841 :group 'c)
842
843 (defcustom-c-stylevar c-backslash-column 48
844 "*Minimum alignment column for line continuation backslashes.
845 This is used by the functions that automatically insert or align the
846 line continuation backslashes in multiline macros. If any line in the
847 macro exceeds this column then the next tab stop from that line is
848 used as alignment column instead. See also `c-backslash-max-column'."
849 :type 'integer
850 :group 'c)
851 ;;;###autoload(put 'c-backslash-column 'safe-local-variable 'integerp)
852
853 (defcustom-c-stylevar c-backslash-max-column 72
854 "*Maximum alignment column for line continuation backslashes.
855 This is used by the functions that automatically insert or align the
856 line continuation backslashes in multiline macros. If any line in the
857 macro exceeds this column then the backslashes for the other lines
858 will be aligned at this column."
859 :type 'integer
860 :group 'c)
861
862 (defcustom c-auto-align-backslashes t
863 "*Align automatically inserted line continuation backslashes.
864 When line continuation backslashes are inserted automatically for line
865 breaks in multiline macros, e.g. by \\[c-context-line-break], they are
866 aligned with the other backslashes in the same macro if this flag is
867 set. Otherwise the inserted backslashes are preceded by a single
868 space."
869 :type 'boolean
870 :group 'c)
871
872 (defcustom c-backspace-function 'backward-delete-char-untabify
873 "*Function called by `c-electric-backspace' when deleting backwards."
874 :type 'function
875 :group 'c)
876
877 (defcustom c-delete-function 'delete-char
878 "*Function called by `c-electric-delete-forward' when deleting forwards."
879 :type 'function
880 :group 'c)
881
882 (defcustom c-require-final-newline
883 ;; C and C++ mandate that all nonempty files should end with a
884 ;; newline. Objective-C refers to C for all things it doesn't
885 ;; specify, so the same holds there. The other languages do not
886 ;; require it (at least not explicitly in a normative text).
887 '((c-mode . t)
888 (c++-mode . t)
889 (objc-mode . t))
890 "*Controls whether a final newline is ensured when the file is saved.
891 The value is an association list that for each language mode specifies
892 the value to give to `require-final-newline' at mode initialization;
893 see that variable for details about the value. If a language isn't
894 present on the association list, CC Mode won't touch
895 `require-final-newline' in buffers for that language."
896 :type `(set (cons :format "%v"
897 (const :format "C " c-mode)
898 (symbol :format "%v" :value ,require-final-newline))
899 (cons :format "%v"
900 (const :format "C++ " c++-mode)
901 (symbol :format "%v" :value ,require-final-newline))
902 (cons :format "%v"
903 (const :format "ObjC " objc-mode)
904 (symbol :format "%v" :value ,require-final-newline))
905 (cons :format "%v"
906 (const :format "Java " java-mode)
907 (symbol :format "%v" :value ,require-final-newline))
908 (cons :format "%v"
909 (const :format "IDL " idl-mode)
910 (symbol :format "%v" :value ,require-final-newline))
911 (cons :format "%v"
912 (const :format "Pike " pike-mode)
913 (symbol :format "%v" :value ,require-final-newline))
914 (cons :format "%v"
915 (const :format "AWK " awk-mode)
916 (symbol :format "%v" :value ,require-final-newline)))
917 :group 'c)
918
919 (defcustom c-electric-pound-behavior nil
920 "*List of behaviors for electric pound insertion.
921 Only currently supported behavior is `alignleft'."
922 :type '(set (const alignleft))
923 :group 'c)
924
925 (defcustom c-special-indent-hook nil
926 "*Hook for user defined special indentation adjustments.
927 This hook gets called after each line is indented by the mode. It is only
928 called when `c-syntactic-indentation' is non-nil."
929 :type 'hook
930 :group 'c)
931
932 (defcustom-c-stylevar c-label-minimum-indentation 1
933 "*Minimum indentation for lines inside code blocks.
934 This variable typically only affects code using the `gnu' style, which
935 mandates a minimum of one space in front of every line inside code
936 blocks. Specifically, the function `c-gnu-impose-minimum' on your
937 `c-special-indent-hook' is what enforces this."
938 :type 'integer
939 :group 'c)
940
941 (defcustom c-progress-interval 5
942 "*Interval used to update progress status during long re-indentation.
943 If a number, percentage complete gets updated after each interval of
944 that many seconds. To inhibit all messages during indentation, set
945 this variable to nil."
946 :type 'integer
947 :group 'c)
948
949 (defcustom c-objc-method-arg-min-delta-to-bracket 2
950 "*Minimum number of chars to the opening bracket.
951
952 Consider this ObjC snippet:
953
954 [foo blahBlah: fred
955 |<-x->|barBaz: barney
956
957 If `x' is less than this number then `c-lineup-ObjC-method-call-colons'
958 will defer the indentation decision to the next function. By default
959 this is `c-lineup-ObjC-method-call', which would align it like:
960
961 [foo blahBlahBlah: fred
962 thisIsTooDamnLong: barney
963
964 This behavior can be overridden by customizing the indentation of
965 `objc-method-call-cont' in the \"objc\" style."
966 :type 'integer
967 :group 'c)
968
969 (defcustom c-objc-method-arg-unfinished-offset 4
970 "*Offset relative to bracket if first selector is on a new line.
971
972 [aaaaaaaaa
973 |<-x->|bbbbbbb: cccccc
974 ddddd: eeee];"
975 :type 'integer
976 :group 'c)
977
978 (defcustom c-objc-method-parameter-offset 4
979 "*Offset for selector parameter on a new line (relative to first selector.
980
981 [aaaaaaa bbbbbbbbbb:
982 |<-x->|cccccccc
983 ddd: eeee
984 ffff: ggg];"
985 :type 'integer
986 :group 'c)
987
988 (defcustom c-default-style '((java-mode . "java") (awk-mode . "awk")
989 (other . "gnu"))
990 "*Style which gets installed by default when a file is visited.
991
992 The value of this variable can be any style defined in
993 `c-style-alist', including styles you add. The value can also be an
994 association list of major mode symbols to style names.
995
996 When the value is a string, all CC Mode major modes will install this
997 style by default.
998
999 When the value is an alist, the major mode symbol is looked up in it
1000 and the associated style is installed. If the major mode is not
1001 listed in the alist, then the symbol `other' is looked up in it, and
1002 if found, the style in that entry is used. If `other' is not found in
1003 the alist, then \"gnu\" style is used.
1004
1005 The default style gets installed before your mode hooks run, so you
1006 can always override the use of `c-default-style' by making calls to
1007 `c-set-style' in the appropriate mode hook."
1008 :type '(radio
1009 (string :tag "Style in all modes")
1010 (set :tag "Mode-specific styles"
1011 (cons :format "%v"
1012 (const :format "C " c-mode) (string :format "%v"))
1013 (cons :format "%v"
1014 (const :format "C++ " c++-mode) (string :format "%v"))
1015 (cons :format "%v"
1016 (const :format "ObjC " objc-mode) (string :format "%v"))
1017 (cons :format "%v"
1018 (const :format "Java " java-mode) (string :format "%v"))
1019 (cons :format "%v"
1020 (const :format "IDL " idl-mode) (string :format "%v"))
1021 (cons :format "%v"
1022 (const :format "Pike " pike-mode) (string :format "%v"))
1023 (cons :format "%v"
1024 (const :format "AWK " awk-mode) (string :format "%v"))
1025 (cons :format "%v"
1026 (const :format "Other " other) (string :format "%v"))))
1027 :group 'c)
1028
1029 ;; *) At the start of a statement or declaration means in more detail:
1030 ;; At the closest preceding statement/declaration that starts at boi
1031 ;; and doesn't have a label or comment at that position. If there's
1032 ;; no such statement within the same block, then back up to the
1033 ;; surrounding block or statement, add the appropriate
1034 ;; statement-block-intro, defun-block-intro or substatement syntax
1035 ;; symbol and continue searching.
1036 (c-set-stylevar-fallback 'c-offsets-alist
1037 '((string . c-lineup-dont-change)
1038 ;; Anchor pos: Beg of previous line.
1039 (c . c-lineup-C-comments)
1040 ;; Anchor pos: Beg of the comment.
1041 (defun-open . 0)
1042 ;; Anchor pos: When inside a class: Boi at the func decl start.
1043 ;; When at top level: Bol at the func decl start. When inside
1044 ;; a code block (only possible in Pike): At the func decl
1045 ;; start(*).
1046 (defun-close . 0)
1047 ;; Anchor pos: At the defun block open if it's at boi,
1048 ;; otherwise boi at the func decl start.
1049 (defun-block-intro . +)
1050 ;; Anchor pos: At the block open(*).
1051 (class-open . 0)
1052 ;; Anchor pos: Boi at the class decl start.
1053 (class-close . 0)
1054 ;; Anchor pos: Boi at the class decl start.
1055 (inline-open . +)
1056 ;; Anchor pos: None for functions (inclass got the relpos
1057 ;; then), boi at the lambda start for lambdas.
1058 (inline-close . 0)
1059 ;; Anchor pos: Inexpr functions: At the lambda block open if
1060 ;; it's at boi, else at the statement(*) at boi of the start of
1061 ;; the lambda construct. Otherwise: At the inline block open
1062 ;; if it's at boi, otherwise boi at the func decl start.
1063 (func-decl-cont . +)
1064 ;; Anchor pos: Boi at the func decl start.
1065 (knr-argdecl-intro . +)
1066 ;; Anchor pos: Boi at the topmost intro line.
1067 (knr-argdecl . 0)
1068 ;; Anchor pos: At the beginning of the first K&R argdecl.
1069 (topmost-intro . 0)
1070 ;; Anchor pos: Bol at the last line of previous construct.
1071 (topmost-intro-cont . c-lineup-topmost-intro-cont)
1072 ;;Anchor pos: Bol at the topmost annotation line
1073 (annotation-top-cont . 0)
1074 ;;Anchor pos: Bol at the topmost annotation line
1075 (annotation-var-cont . +)
1076 ;; Anchor pos: Boi at the topmost intro line.
1077 (member-init-intro . +)
1078 ;; Anchor pos: Boi at the func decl arglist open.
1079 (member-init-cont . c-lineup-multi-inher)
1080 ;; Anchor pos: Beg of the first member init.
1081 (inher-intro . +)
1082 ;; Anchor pos: Boi at the class decl start.
1083 (inher-cont . c-lineup-multi-inher)
1084 ;; Anchor pos: Java: At the implements/extends keyword start.
1085 ;; Otherwise: At the inher start colon, or boi at the class
1086 ;; decl start if the first inherit clause hangs and it's not a
1087 ;; func-local inherit clause (when does that occur?).
1088 (block-open . 0)
1089 ;; Anchor pos: Inexpr statement: At the statement(*) at boi of
1090 ;; the start of the inexpr construct. Otherwise: None.
1091 (block-close . 0)
1092 ;; Anchor pos: Inexpr statement: At the inexpr block open if
1093 ;; it's at boi, else at the statement(*) at boi of the start of
1094 ;; the inexpr construct. Block hanging on a case/default
1095 ;; label: At the closest preceding label that starts at boi.
1096 ;; Otherwise: At the block open(*).
1097 (brace-list-open . 0)
1098 ;; Anchor pos: Boi at the brace list decl start, but a starting
1099 ;; "typedef" token is ignored.
1100 (brace-list-close . 0)
1101 ;; Anchor pos: At the brace list decl start(*).
1102 (brace-list-intro . +)
1103 ;; Anchor pos: At the brace list decl start(*).
1104 (brace-list-entry . 0)
1105 ;; Anchor pos: At the first non-ws char after the open paren if
1106 ;; the first token is on the same line, otherwise boi at that
1107 ;; token.
1108 (brace-entry-open . 0)
1109 ;; Anchor pos: Same as brace-list-entry.
1110 (statement . 0)
1111 ;; Anchor pos: After a `;' in the condition clause of a for
1112 ;; statement: At the first token after the starting paren.
1113 ;; Otherwise: At the preceding statement(*).
1114 (statement-cont . +)
1115 ;; Anchor pos: After the first token in the condition clause of
1116 ;; a for statement: At the first token after the starting
1117 ;; paren. Otherwise: At the containing statement(*).
1118 (statement-block-intro . +)
1119 ;; Anchor pos: In inexpr statement block: At the inexpr block
1120 ;; open if it's at boi, else at the statement(*) at boi of the
1121 ;; start of the inexpr construct. In a block hanging on a
1122 ;; case/default label: At the closest preceding label that
1123 ;; starts at boi. Otherwise: At the start of the containing
1124 ;; block(*).
1125 (statement-case-intro . +)
1126 ;; Anchor pos: At the case/default label(*).
1127 (statement-case-open . 0)
1128 ;; Anchor pos: At the case/default label(*).
1129 (substatement . +)
1130 ;; Anchor pos: At the containing statement(*).
1131 (substatement-open . +)
1132 ;; Anchor pos: At the containing statement(*).
1133 (substatement-label . 2)
1134 ;; Anchor pos: At the containing statement(*).
1135 (case-label . 0)
1136 ;; Anchor pos: At the start of the switch block(*).
1137 (access-label . -)
1138 ;; Anchor pos: Same as inclass.
1139 (label . 2)
1140 ;; Anchor pos: At the start of the containing block(*).
1141 (do-while-closure . 0)
1142 ;; Anchor pos: At the corresponding while statement(*).
1143 (else-clause . 0)
1144 ;; Anchor pos: At the corresponding if statement(*).
1145 (catch-clause . 0)
1146 ;; Anchor pos: At the previous try or catch statement clause(*).
1147 (comment-intro . (c-lineup-knr-region-comment c-lineup-comment))
1148 ;; Anchor pos: None.
1149 (arglist-intro . +)
1150 ;; Anchor pos: At the containing statement(*).
1151 ;; 2nd pos: At the open paren.
1152 (arglist-cont . (c-lineup-gcc-asm-reg 0))
1153 ;; Anchor pos: At the first token after the open paren.
1154 (arglist-cont-nonempty . (c-lineup-gcc-asm-reg c-lineup-arglist))
1155 ;; Anchor pos: At the containing statement(*).
1156 ;; 2nd pos: At the open paren.
1157 (arglist-close . +)
1158 ;; Anchor pos: At the containing statement(*).
1159 ;; 2nd pos: At the open paren.
1160 (stream-op . c-lineup-streamop)
1161 ;; Anchor pos: Boi at the first stream op in the statement.
1162 (inclass . +)
1163 ;; Anchor pos: At the class open brace if it's at boi,
1164 ;; otherwise boi at the class decl start.
1165 (cpp-macro . [0])
1166 ;; Anchor pos: None.
1167 (cpp-macro-cont . +)
1168 ;; Anchor pos: At the macro start (always at boi).
1169 (cpp-define-intro . (c-lineup-cpp-define +))
1170 ;; Anchor pos: None.
1171 (friend . 0)
1172 ;; Anchor pos: None.
1173 (objc-method-intro . [0])
1174 ;; Anchor pos: Boi.
1175 (objc-method-args-cont . c-lineup-ObjC-method-args)
1176 ;; Anchor pos: At the method start (always at boi).
1177 (objc-method-call-cont . (c-lineup-ObjC-method-call-colons
1178 c-lineup-ObjC-method-call +))
1179 ;; Anchor pos: At the open bracket.
1180 (extern-lang-open . 0)
1181 (namespace-open . 0)
1182 (module-open . 0)
1183 (composition-open . 0)
1184 ;; Anchor pos: Boi at the extern/namespace/etc keyword.
1185 (extern-lang-close . 0)
1186 (namespace-close . 0)
1187 (module-close . 0)
1188 (composition-close . 0)
1189 ;; Anchor pos: Boi at the corresponding extern/namespace/etc keyword.
1190 (inextern-lang . +)
1191 (innamespace . +)
1192 (inmodule . +)
1193 (incomposition . +)
1194 ;; Anchor pos: At the extern/namespace/etc block open brace if
1195 ;; it's at boi, otherwise boi at the keyword.
1196 (template-args-cont . (c-lineup-template-args +))
1197 ;; Anchor pos: Boi at the decl start. This might be changed;
1198 ;; the logical position is clearly the opening '<'.
1199 (inlambda . c-lineup-inexpr-block)
1200 ;; Anchor pos: None.
1201 (lambda-intro-cont . +)
1202 ;; Anchor pos: Boi at the lambda start.
1203 (inexpr-statement . +)
1204 ;; Anchor pos: None.
1205 (inexpr-class . +)
1206 ;; Anchor pos: None.
1207 ))
1208 (defcustom c-offsets-alist nil
1209 "Association list of syntactic element symbols and indentation offsets.
1210 As described below, each cons cell in this list has the form:
1211
1212 (SYNTACTIC-SYMBOL . OFFSET)
1213
1214 When a line is indented, CC Mode first determines the syntactic
1215 context of it by generating a list of symbols called syntactic
1216 elements. The global variable `c-syntactic-context' is bound to the
1217 that list. Each element in the list is in turn a list where the first
1218 element is a syntactic symbol which tells what kind of construct the
1219 indentation point is located within. More elements in the syntactic
1220 element lists are optional. If there is one more and it isn't nil,
1221 then it's the anchor position for that construct.
1222
1223 After generating the syntactic context for the line, CC Mode
1224 calculates the absolute indentation: First the base indentation is
1225 found by using the anchor position for the first syntactic element
1226 that provides one. If none does, zero is used as base indentation.
1227 Then CC Mode looks at each syntactic element in the context in turn.
1228 It compares the car of the syntactic element against the
1229 SYNTACTIC-SYMBOL's in `c-offsets-alist'. When it finds a match, it
1230 adds OFFSET to the base indentation. The sum of this calculation is
1231 the absolute offset for line being indented.
1232
1233 If the syntactic element does not match any in the `c-offsets-alist',
1234 the element is ignored.
1235
1236 OFFSET can specify an offset in several different ways:
1237
1238 If OFFSET is nil then it's ignored.
1239
1240 If OFFSET is an integer then it's used as relative offset, i.e. it's
1241 added to the base indentation.
1242
1243 If OFFSET is one of the symbols `+', `-', `++', `--', `*', or `/'
1244 then a positive or negative multiple of `c-basic-offset' is added to
1245 the base indentation; 1, -1, 2, -2, 0.5, and -0.5, respectively.
1246
1247 If OFFSET is a symbol with a value binding then that value, which
1248 must be an integer, is used as relative offset.
1249
1250 If OFFSET is a vector then its first element, which must be an
1251 integer, is used as an absolute indentation column. This overrides
1252 the previous base indentation and the relative offsets applied to
1253 it, and it becomes the new base indentation.
1254
1255 If OFFSET is a function or a lambda expression then it's called with
1256 a single argument containing the cons of the syntactic symbol and
1257 the anchor position (or nil if there is none). The return value
1258 from the function is then reinterpreted as an offset specification.
1259
1260 If OFFSET is a list then its elements are evaluated recursively as
1261 offset specifications. If the first element is any of the symbols
1262 below then it isn't evaluated but instead specifies how the
1263 remaining offsets in the list should be combined. If it's something
1264 else then the list is combined according the method `first'. The
1265 valid combination methods are:
1266
1267 `first' -- Use the first offset (that doesn't evaluate to nil).
1268 `min' -- Use the minimum of all the offsets. All must be either
1269 relative or absolute - they can't be mixed.
1270 `max' -- Use the maximum of all the offsets. All must be either
1271 relative or absolute - they can't be mixed.
1272 `add' -- Add all the evaluated offsets together. Exactly one of
1273 them may be absolute, in which case the result is
1274 absolute. Any relative offsets that preceded the
1275 absolute one in the list will be ignored in that case.
1276
1277 `c-offsets-alist' is a style variable. This means that the offsets on
1278 this variable are normally taken from the style system in CC Mode
1279 \(see `c-default-style' and `c-style-alist'). However, any offsets
1280 put explicitly on this list will override the style system when a CC
1281 Mode buffer is initialized \(there is a variable
1282 `c-old-style-variable-behavior' that changes this, though).
1283
1284 Here is the current list of valid syntactic element symbols:
1285
1286 string -- Inside multi-line string.
1287 c -- Inside a multi-line C style block comment.
1288 defun-open -- Brace that opens a function definition.
1289 defun-close -- Brace that closes a function definition.
1290 defun-block-intro -- The first line in a top-level defun.
1291 class-open -- Brace that opens a class definition.
1292 class-close -- Brace that closes a class definition.
1293 inline-open -- Brace that opens an in-class inline method.
1294 inline-close -- Brace that closes an in-class inline method.
1295 func-decl-cont -- The region between a function definition's
1296 argument list and the function opening brace
1297 (excluding K&R argument declarations). In C, you
1298 cannot put anything but whitespace and comments
1299 between them; in C++ and Java, throws declarations
1300 and other things can appear in this context.
1301 knr-argdecl-intro -- First line of a K&R C argument declaration.
1302 knr-argdecl -- Subsequent lines in a K&R C argument declaration.
1303 topmost-intro -- The first line in a topmost construct definition.
1304 topmost-intro-cont -- Topmost definition continuation lines.
1305 annotation-top-cont -- Topmost definition continuation line where only
1306 annotations are on previous lines.
1307 annotation-var-cont -- A continuation of a C (or like) statement where
1308 only annotations are on previous lines.
1309 member-init-intro -- First line in a member initialization list.
1310 member-init-cont -- Subsequent member initialization list lines.
1311 inher-intro -- First line of a multiple inheritance list.
1312 inher-cont -- Subsequent multiple inheritance lines.
1313 block-open -- Statement block open brace.
1314 block-close -- Statement block close brace.
1315 brace-list-open -- Open brace of an enum or static array list.
1316 brace-list-close -- Close brace of an enum or static array list.
1317 brace-list-intro -- First line in an enum or static array list.
1318 brace-list-entry -- Subsequent lines in an enum or static array list.
1319 brace-entry-open -- Subsequent lines in an enum or static array
1320 list that start with an open brace.
1321 statement -- A C (or like) statement.
1322 statement-cont -- A continuation of a C (or like) statement.
1323 statement-block-intro -- The first line in a new statement block.
1324 statement-case-intro -- The first line in a case \"block\".
1325 statement-case-open -- The first line in a case block starting with brace.
1326 substatement -- The first line after an if/while/for/do/else.
1327 substatement-open -- The brace that opens a substatement block.
1328 substatement-label -- Labeled line after an if/while/for/do/else.
1329 case-label -- A \"case\" or \"default\" label.
1330 access-label -- C++ private/protected/public access label.
1331 label -- Any ordinary label.
1332 do-while-closure -- The \"while\" that ends a do/while construct.
1333 else-clause -- The \"else\" of an if/else construct.
1334 catch-clause -- The \"catch\" or \"finally\" of a try/catch construct.
1335 comment-intro -- A line containing only a comment introduction.
1336 arglist-intro -- The first line in an argument list.
1337 arglist-cont -- Subsequent argument list lines when no
1338 arguments follow on the same line as the
1339 arglist opening paren.
1340 arglist-cont-nonempty -- Subsequent argument list lines when at
1341 least one argument follows on the same
1342 line as the arglist opening paren.
1343 arglist-close -- The solo close paren of an argument list.
1344 stream-op -- Lines continuing a stream operator construct.
1345 inclass -- The construct is nested inside a class definition.
1346 Used together with e.g. `topmost-intro'.
1347 cpp-macro -- The start of a C preprocessor macro definition.
1348 cpp-macro-cont -- Inside a multi-line C preprocessor macro definition.
1349 friend -- A C++ friend declaration.
1350 objc-method-intro -- The first line of an Objective-C method definition.
1351 objc-method-args-cont -- Lines continuing an Objective-C method definition.
1352 objc-method-call-cont -- Lines continuing an Objective-C method call.
1353 extern-lang-open -- Brace that opens an \"extern\" block.
1354 extern-lang-close -- Brace that closes an \"extern\" block.
1355 inextern-lang -- Analogous to the `inclass' syntactic symbol,
1356 but used inside \"extern\" blocks.
1357 namespace-open, namespace-close, innamespace
1358 -- Similar to the three `extern-lang' symbols, but for
1359 C++ \"namespace\" blocks.
1360 module-open, module-close, inmodule
1361 -- Similar to the three `extern-lang' symbols, but for
1362 CORBA IDL \"module\" blocks.
1363 composition-open, composition-close, incomposition
1364 -- Similar to the three `extern-lang' symbols, but for
1365 CORBA CIDL \"composition\" blocks.
1366 template-args-cont -- C++ template argument list continuations.
1367 inlambda -- In the header or body of a lambda function.
1368 lambda-intro-cont -- Continuation of the header of a lambda function.
1369 inexpr-statement -- The statement is inside an expression.
1370 inexpr-class -- The class is inside an expression. Used e.g. for
1371 Java anonymous classes."
1372 :type
1373 `(set :format "%{%t%}:
1374 Override style setting
1375 | Syntax Offset
1376 %v"
1377 ,@(mapcar
1378 (lambda (elt)
1379 `(cons :format "%v"
1380 :value ,elt
1381 ,(c-constant-symbol (car elt) 25)
1382 (sexp :format "%v"
1383 :validate
1384 (lambda (widget)
1385 (unless (c-valid-offset (widget-value widget))
1386 (widget-put widget :error "Invalid offset")
1387 widget)))))
1388 (get 'c-offsets-alist 'c-stylevar-fallback)))
1389 :group 'c)
1390
1391 ;; The syntactic symbols that can occur inside code blocks. Used by
1392 ;; `c-gnu-impose-minimum'.
1393 (defconst c-inside-block-syms
1394 '(defun-block-intro block-open block-close statement statement-cont
1395 statement-block-intro statement-case-intro statement-case-open
1396 substatement substatement-open substatement-label case-label label
1397 do-while-closure else-clause catch-clause inlambda annotation-var-cont))
1398
1399 (defcustom c-style-variables-are-local-p t
1400 "*Whether style variables should be buffer local by default.
1401 If non-nil, then all indentation style related variables will be made
1402 buffer local by default. If nil, they will remain global. Variables
1403 are made buffer local when this file is loaded, and once buffer
1404 localized, they cannot be made global again.
1405
1406 This variable must be set appropriately before CC Mode is loaded.
1407
1408 The list of variables to buffer localize are:
1409 c-basic-offset
1410 c-comment-only-line-offset
1411 c-indent-comment-alist
1412 c-indent-comments-syntactically-p
1413 c-block-comment-prefix
1414 c-comment-prefix-regexp
1415 c-doc-comment-style
1416 c-cleanup-list
1417 c-hanging-braces-alist
1418 c-hanging-colons-alist
1419 c-hanging-semi&comma-criteria
1420 c-backslash-column
1421 c-backslash-max-column
1422 c-label-minimum-indentation
1423 c-offsets-alist
1424 c-special-indent-hook
1425 c-indentation-style"
1426 :type 'boolean
1427 :safe 'booleanp
1428 :group 'c)
1429
1430 (defcustom c-mode-hook nil
1431 "*Hook called by `c-mode'."
1432 :type 'hook
1433 :group 'c)
1434
1435 (defcustom c++-mode-hook nil
1436 "*Hook called by `c++-mode'."
1437 :type 'hook
1438 :group 'c)
1439
1440 (defcustom objc-mode-hook nil
1441 "*Hook called by `objc-mode'."
1442 :type 'hook
1443 :group 'c)
1444
1445 (defcustom java-mode-hook nil
1446 "*Hook called by `java-mode'."
1447 :type 'hook
1448 :group 'c)
1449
1450 (defcustom idl-mode-hook nil
1451 "*Hook called by `idl-mode'."
1452 :type 'hook
1453 :group 'c)
1454
1455 (defcustom pike-mode-hook nil
1456 "*Hook called by `pike-mode'."
1457 :type 'hook
1458 :group 'c)
1459
1460 (defcustom awk-mode-hook nil
1461 "*Hook called by `awk-mode'."
1462 :type 'hook
1463 :group 'c)
1464
1465 (defcustom c-mode-common-hook nil
1466 "*Hook called by all CC Mode modes for common initializations."
1467 :type 'hook
1468 :group 'c)
1469
1470 (defcustom c-initialization-hook nil
1471 "*Hook called when the CC Mode package gets initialized.
1472 This hook is only run once per Emacs session and can be used as a
1473 `load-hook' or in place of using `eval-after-load'."
1474 :type 'hook
1475 :group 'c)
1476
1477 (defcustom c-enable-xemacs-performance-kludge-p nil
1478 "*Enables a XEmacs only hack that may improve speed for some coding styles.
1479 For styles that hang top-level opening braces (as is common with JDK
1480 Java coding styles) this can improve performance between 3 and 60
1481 times for core indentation functions (e.g. `c-parse-state'). For
1482 styles that conform to the Emacs recommendation of putting these
1483 braces in column zero, this can degrade performance about as much.
1484 This variable only has effect in XEmacs."
1485 :type 'boolean
1486 :group 'c)
1487
1488 (defvar c-old-style-variable-behavior nil
1489 "*Enables the old style variable behavior when non-nil.
1490
1491 Normally the values of the style variables will override the style
1492 settings specified by the variables `c-default-style' and
1493 `c-style-alist'. However, in CC Mode 5.25 and earlier, it was the
1494 other way around, meaning that changes made to the style variables
1495 from e.g. Customize would not take effect unless special precautions
1496 were taken. That was confusing, especially for novice users.
1497
1498 It's believed that despite this change, the new behavior will still
1499 produce the same results for most old CC Mode configurations, since
1500 all style variables are per default set in a special non-override
1501 state. Set this variable only if your configuration has stopped
1502 working due to this change.")
1503
1504 (define-widget 'c-extra-types-widget 'radio
1505 "Internal CC Mode widget for the `*-font-lock-extra-types' variables."
1506 :args '((const :tag "none" nil)
1507 (repeat :tag "types" regexp)))
1508
1509 (defun c-make-font-lock-extra-types-blurb (mode1 mode2 example)
1510 (concat "\
1511 *List of extra types (aside from the type keywords) to recognize in "
1512 mode1 " mode.
1513 Each list item should be a regexp matching a single identifier.
1514 " example "
1515
1516 Note that items on this list that don't include any regexp special
1517 characters are automatically optimized using `regexp-opt', so you
1518 should not use `regexp-opt' explicitly to build regexps here.
1519
1520 On decoration level 3 (and higher, where applicable), a method is used
1521 that finds most types and declarations by syntax alone. This variable
1522 is still used as a first step, but other types are recognized
1523 correctly anyway in most cases. Therefore this variable should be
1524 fairly restrictive and not contain patterns that are uncertain.
1525
1526 Note that this variable is only consulted when the major mode is
1527 initialized. If you change it later you have to reinitialize CC Mode
1528 by doing \\[" mode2 "].
1529
1530 Despite the name, this variable is not only used for font locking but
1531 also elsewhere in CC Mode to tell types from other identifiers."))
1532
1533 ;; Note: Most of the variables below are also defined in font-lock.el
1534 ;; in older versions of Emacs, so depending on the load order we might
1535 ;; not install the values below. There's no kludge to cope with this
1536 ;; (as opposed to the *-font-lock-keywords-* variables) since the old
1537 ;; values work fairly well anyway.
1538
1539 (defcustom c-font-lock-extra-types
1540 '("\\sw+_t"
1541 ;; Defined in C99:
1542 "bool" "complex" "imaginary"
1543 ;; Standard library types (except those matched by the _t pattern):
1544 "FILE" "lconv" "tm" "va_list" "jmp_buf"
1545 ;; I do not appreciate the following very Emacs-specific luggage
1546 ;; in the default value, but otoh it can hardly get in the way for
1547 ;; other users, and removing it would cause unnecessary grief for
1548 ;; the old timers that are used to it. /mast
1549 "Lisp_Object")
1550 (c-make-font-lock-extra-types-blurb "C" "c-mode"
1551 "For example, a value of (\"FILE\" \"\\\\sw+_t\") means the word \"FILE\"
1552 and words ending in \"_t\" are treated as type names.")
1553 :type 'c-extra-types-widget
1554 :group 'c)
1555
1556 (defcustom c++-font-lock-extra-types
1557 '("\\sw+_t"
1558 ;; C library types (except those matched by the _t pattern):
1559 "FILE" "lconv" "tm" "va_list" "jmp_buf"
1560 ;; Some standard C++ types that came from font-lock.el.
1561 ;; Experienced C++ users says there's no clear benefit in
1562 ;; extending this to all the types in the standard library, at
1563 ;; least not when they'll be recognized without "std::" too.
1564 "istream" "istreambuf"
1565 "ostream" "ostreambuf"
1566 "ifstream" "ofstream" "fstream"
1567 "strstream" "strstreambuf" "istrstream" "ostrstream"
1568 "ios"
1569 "string" "rope"
1570 "list" "slist"
1571 "deque" "vector" "bit_vector"
1572 "set" "multiset"
1573 "map" "multimap"
1574 "hash"
1575 "hash_set" "hash_multiset"
1576 "hash_map" "hash_multimap"
1577 "stack" "queue" "priority_queue"
1578 "type_info"
1579 "iterator" "const_iterator" "reverse_iterator" "const_reverse_iterator"
1580 "reference" "const_reference")
1581 (c-make-font-lock-extra-types-blurb "C++" "c++-mode"
1582 "For example, a value of (\"string\") means the word \"string\" is treated
1583 as a type name.")
1584 :type 'c-extra-types-widget
1585 :group 'c)
1586
1587 (defcustom objc-font-lock-extra-types
1588 (list (concat "[" c-upper "]\\sw*[" c-lower "]\\sw*"))
1589 (c-make-font-lock-extra-types-blurb "ObjC" "objc-mode" (concat
1590 "For example, a value of (\"[" c-upper "]\\\\sw*[" c-lower "]\\\\sw*\") means
1591 capitalized words are treated as type names (the requirement for a
1592 lower case char is to avoid recognizing all-caps macro and constant
1593 names)."))
1594 :type 'c-extra-types-widget
1595 :group 'c)
1596
1597 (defcustom java-font-lock-extra-types
1598 (list (concat "[" c-upper "]\\sw*[" c-lower "]\\sw"))
1599 (c-make-font-lock-extra-types-blurb "Java" "java-mode" (concat
1600 "For example, a value of (\"[" c-upper "]\\\\sw*[" c-lower "]\\\\sw*\") means
1601 capitalized words are treated as type names (the requirement for a
1602 lower case char is to avoid recognizing all-caps constant names)."))
1603 :type 'c-extra-types-widget
1604 :group 'c)
1605
1606 (defcustom idl-font-lock-extra-types nil
1607 (c-make-font-lock-extra-types-blurb "IDL" "idl-mode" "")
1608 :type 'c-extra-types-widget
1609 :group 'c)
1610
1611 (defcustom pike-font-lock-extra-types
1612 (list (concat "[" c-upper "]\\sw*[" c-lower "]\\sw*"))
1613 (c-make-font-lock-extra-types-blurb "Pike" "pike-mode" (concat
1614 "For example, a value of (\"[" c-upper "]\\\\sw*[" c-lower "]\\\\sw*\") means
1615 capitalized words are treated as type names (the requirement for a
1616 lower case char is to avoid recognizing all-caps macro and constant
1617 names)."))
1618 :type 'c-extra-types-widget
1619 :group 'c)
1620
1621 \f
1622 ;; Non-customizable variables, still part of the interface to CC Mode
1623 (defvar c-macro-with-semi-re nil
1624 ;; Regular expression which matches a (#define'd) symbol whose expansion
1625 ;; ends with a semicolon.
1626 ;;
1627 ;; This variable should be set by `c-make-macros-with-semi-re' rather than
1628 ;; directly.
1629 )
1630 (make-variable-buffer-local 'c-macro-with-semi-re)
1631
1632 (defvar c-macro-names-with-semicolon
1633 '("Q_OBJECT" "Q_PROPERTY" "Q_DECLARE" "Q_ENUMS")
1634 "List of #defined symbols whose expansion ends with a semicolon.
1635 Alternatively it can be a string, a regular expression which
1636 matches all such symbols.
1637
1638 The \"symbols\" must be syntactically valid identifiers in the
1639 target language \(C, C++, Objective C), or \(as the case may be)
1640 the regular expression must match only valid identifiers.
1641
1642 If you change this variable's value, call the function
1643 `c-make-macros-with-semi-re' to set the necessary internal
1644 variables.
1645
1646 Note that currently \(2008-11-04) this variable is a prototype,
1647 and is likely to disappear or change its form soon.")
1648 (make-variable-buffer-local 'c-macro-names-with-semicolon)
1649
1650 (defun c-make-macro-with-semi-re ()
1651 ;; Convert `c-macro-names-with-semicolon' into the regexp
1652 ;; `c-macro-with-semi-re' (or just copy it if it's already a re).
1653 (setq c-macro-with-semi-re
1654 (and
1655 (boundp 'c-opt-cpp-macro-define)
1656 c-opt-cpp-macro-define
1657 (cond
1658 ((stringp c-macro-names-with-semicolon)
1659 (copy-sequence c-macro-names-with-semicolon))
1660 ((consp c-macro-names-with-semicolon)
1661 (concat
1662 "\\<"
1663 (regexp-opt c-macro-names-with-semicolon)
1664 "\\>")) ; N.B. the PAREN param of regexp-opt isn't supported by
1665 ; all XEmacsen.
1666 ((null c-macro-names-with-semicolon)
1667 nil)
1668 (t (error "c-make-macro-with-semi-re: invalid \
1669 c-macro-names-with-semicolon: %s"
1670 c-macro-names-with-semicolon))))))
1671
1672 (defvar c-file-style nil
1673 "Variable interface for setting style via File Local Variables.
1674 In a file's Local Variable section, you can set this variable to a
1675 string suitable for `c-set-style'. When the file is visited, CC Mode
1676 will set the style of the file to this value automatically.
1677
1678 Note that file style settings are applied before file offset settings
1679 as designated in the variable `c-file-offsets'.")
1680 (make-variable-buffer-local 'c-file-style)
1681 ;;;###autoload(put 'c-file-style 'safe-local-variable 'string-or-null-p)
1682
1683 (defvar c-file-offsets nil
1684 "Variable interface for setting offsets via File Local Variables.
1685 In a file's Local Variable section, you can set this variable to an
1686 association list similar to the values allowed in `c-offsets-alist'.
1687 When the file is visited, CC Mode will institute these offset settings
1688 automatically.
1689
1690 Note that file offset settings are applied after file style settings
1691 as designated in the variable `c-file-style'.")
1692 (make-variable-buffer-local 'c-file-offsets)
1693
1694 ;; It isn't possible to specify a doc-string without specifying an
1695 ;; initial value with `defvar', so the following two variables have been
1696 ;; given doc-strings by setting the property `variable-documentation'
1697 ;; directly. C-h v will read this documentation only for versions of GNU
1698 ;; Emacs from 22.1. It's really good not to have an initial value for
1699 ;; variables like these that always should be dynamically bound, so it's
1700 ;; worth the inconvenience.
1701
1702 (cc-bytecomp-defvar c-syntactic-context)
1703 (defvar c-syntactic-context)
1704 (put 'c-syntactic-context 'variable-documentation
1705 "Variable containing the syntactic analysis list for a line of code.
1706
1707 It is a list with one element for each syntactic symbol pertinent to the
1708 line, for example \"((defun-block-intro 1) (comment-intro))\".
1709
1710 It is dynamically bound when calling \(i) a brace hanging \"action
1711 function\"; \(ii) a semicolon/comma hanging \"criteria function\"; \(iii) a
1712 \"line-up function\"; \(iv) a c-special-indent-hook function. It is also
1713 used internally by CC Mode.
1714
1715 c-syntactic-context is always bound dynamically. It must NEVER be set
1716 statically (e.g. with `setq').")
1717
1718
1719 (cc-bytecomp-defvar c-syntactic-element)
1720 (defvar c-syntactic-element)
1721 (put 'c-syntactic-element 'variable-documentation
1722 "Variable containing the current syntactic element during calls to
1723 the lineup functions. The value is one of the elements in the list in
1724 `c-syntactic-context' and is a list with the symbol name in the first
1725 position, followed by zero or more elements containing any additional
1726 info associated with the syntactic symbol. There are accessor functions
1727 `c-langelem-sym', `c-langelem-pos', `c-langelem-col', and
1728 `c-langelem-2nd-pos' to access the list.
1729
1730 Specifically, the element returned by `c-langelem-pos' is the anchor
1731 position, or nil if there isn't any. See the comments in the
1732 `c-offsets-alist' variable and the CC Mode manual for more detailed info
1733 about the data each syntactic symbol provides.
1734
1735 This is always bound dynamically. It should never be set
1736 statically (e.g. with `setq').")
1737
1738 (defvar c-indentation-style nil
1739 "Name of the currently installed style.
1740 Don't change this directly; call `c-set-style' instead, or set the variable
1741 `c-file-style' in the file's Local Variable list.")
1742
1743 (defvar c-current-comment-prefix nil
1744 "The current comment prefix regexp.
1745 Set from `c-comment-prefix-regexp' at mode initialization.")
1746 (make-variable-buffer-local 'c-current-comment-prefix)
1747
1748 ;; N.B. The next three variables are initialized in
1749 ;; c-setup-paragraph-variables. Their initializations here are "just in
1750 ;; case". ACM, 2004/2/15. They are NOT buffer local (yet?).
1751 (defvar c-string-par-start
1752 ;; (concat "\\(" (default-value 'paragraph-start) "\\)\\|[ \t]*\\\\$")
1753 "\f\\|[ \t]*\\\\?$"
1754 "Value of paragraph-start used when scanning strings.
1755 It treats escaped EOLs as whitespace.")
1756
1757 (defvar c-string-par-separate
1758 ;; (concat "\\(" (default-value 'paragraph-separate) "\\)\\|[ \t]*\\\\$")
1759 "[ \t\f]*\\\\?$"
1760 "Value of paragraph-separate used when scanning strings.
1761 It treats escaped EOLs as whitespace.")
1762
1763 (defvar c-sentence-end-with-esc-eol
1764 (concat "\\(\\(" (c-default-value-sentence-end) "\\)"
1765 ;; N.B.: "$" would be illegal when not enclosed like "\\($\\)".
1766 "\\|" "[.?!][]\"')}]* ?\\\\\\($\\)[ \t\n]*"
1767 "\\)")
1768 "Value used like sentence-end used when scanning strings.
1769 It treats escaped EOLs as whitespace.")
1770
1771 \f
1772 (cc-provide 'cc-vars)
1773
1774 ;;; cc-vars.el ends here