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