comparison lisp/progmodes/cc-vars.el @ 24282:5b0864259a4b Release_5_25

Installed CC Mode 5.25.
author Barry A. Warsaw <barry@zope.org>
date Mon, 08 Feb 1999 16:53:18 +0000
parents dad4e4facdc0
children 03befb219d03
comparison
equal deleted inserted replaced
24281:d03b1e915af1 24282:5b0864259a4b
1 ;;; cc-vars.el --- user customization variables for CC Mode 1 ;;; cc-vars.el --- user customization variables for CC Mode
2 2
3 ;; Copyright (C) 1985,87,92,93,94,95,96,97,98 Free Software Foundation, Inc. 3 ;; Copyright (C) 1985,87,92,93,94,95,96,97,98 Free Software Foundation, Inc.
4 4
5 ;; Authors: 1992-1997 Barry A. Warsaw 5 ;; Authors: 1998 Barry A. Warsaw and Martin Stjernholm
6 ;; 1992-1997 Barry A. Warsaw
6 ;; 1987 Dave Detlefs and Stewart Clamen 7 ;; 1987 Dave Detlefs and Stewart Clamen
7 ;; 1985 Richard M. Stallman 8 ;; 1985 Richard M. Stallman
8 ;; Maintainer: cc-mode-help@python.org 9 ;; Maintainer: bug-cc-mode@gnu.org
9 ;; Created: 22-Apr-1997 (split from cc-mode.el) 10 ;; Created: 22-Apr-1997 (split from cc-mode.el)
10 ;; Version: See cc-mode.el 11 ;; Version: See cc-mode.el
11 ;; Keywords: c languages oop 12 ;; Keywords: c languages oop
12 13
13 ;; This file is part of GNU Emacs. 14 ;; This file is part of GNU Emacs.
25 ;; You should have received a copy of the GNU General Public License 26 ;; You should have received a copy of the GNU General Public License
26 ;; along with GNU Emacs; see the file COPYING. If not, write to the 27 ;; along with GNU Emacs; see the file COPYING. If not, write to the
27 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 28 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
28 ;; Boston, MA 02111-1307, USA. 29 ;; Boston, MA 02111-1307, USA.
29 30
31 (eval-when-compile
32 (require 'cc-defs))
33
30 (require 'custom) 34 (require 'custom)
31 35
32 36
33 (defcustom c-strict-syntax-p nil 37 (defcustom c-strict-syntax-p nil
34 "*If non-nil, all syntactic symbols must be found in `c-offsets-alist'. 38 "*If non-nil, all syntactic symbols must be found in `c-offsets-alist'.
35 If the syntactic symbol for a particular line does not match a symbol 39 If the syntactic symbol for a particular line does not match a symbol
36 in the offsets alist, an error is generated, otherwise no error is 40 in the offsets alist, or if no non-nil offset value can be determined
37 reported and the syntactic symbol is ignored." 41 for a symbol, an error is generated, otherwise no error is reported
42 and the syntactic symbol is ignored."
38 :type 'boolean 43 :type 'boolean
39 :group 'c) 44 :group 'c)
40 45
41 (defcustom c-echo-syntactic-information-p nil 46 (defcustom c-echo-syntactic-information-p nil
42 "*If non-nil, syntactic info is echoed when the line is indented." 47 "*If non-nil, syntactic info is echoed when the line is indented."
45 50
46 (defcustom c-basic-offset 4 51 (defcustom c-basic-offset 4
47 "*Amount of basic offset used by + and - symbols in `c-offsets-alist'." 52 "*Amount of basic offset used by + and - symbols in `c-offsets-alist'."
48 :type 'integer 53 :type 'integer
49 :group 'c) 54 :group 'c)
55
56 ;; This widget will show up in newer versions of the Custom library
57 (or (get 'other 'widget-type)
58 (define-widget 'other 'sexp
59 "Matches everything, but doesn't let the user edit the value.
60 Useful as last item in a `choice' widget."
61 :tag "Other"
62 :format "%t%n"
63 :value 'other))
50 64
51 (defcustom c-tab-always-indent t 65 (defcustom c-tab-always-indent t
52 "*Controls the operation of the TAB key. 66 "*Controls the operation of the TAB key.
53 If t, hitting TAB always just indents the current line. If nil, 67 If t, hitting TAB always just indents the current line. If nil,
54 hitting TAB indents the current line if point is at the left margin or 68 hitting TAB indents the current line if point is at the left margin or
55 in the line's indentation, otherwise it insert a `real' tab character 69 in the line's indentation, otherwise it insert a `real' tab character
56 \(see note\). If other than nil or t, then tab is inserted only 70 \(see note\). If the symbol `other', then tab is inserted only within
57 within literals -- defined as comments and strings -- and inside 71 literals -- defined as comments and strings -- and inside preprocessor
58 preprocessor directives, but line is always reindented. 72 directives, but the line is always reindented.
59 73
60 Note: The value of `indent-tabs-mode' will determine whether a real 74 Note: The value of `indent-tabs-mode' will determine whether a real
61 tab character will be inserted, or the equivalent number of space. 75 tab character will be inserted, or the equivalent number of space.
62 When inserting a tab, actually the function stored in the variable 76 When inserting a tab, actually the function stored in the variable
63 `c-insert-tab-function' is called. 77 `c-insert-tab-function' is called.
67 :type '(radio 81 :type '(radio
68 :extra-offset 8 82 :extra-offset 8
69 :format "%{C Tab Always Indent%}:\n The TAB key:\n%v" 83 :format "%{C Tab Always Indent%}:\n The TAB key:\n%v"
70 (const :tag "always indents, never inserts TAB" t) 84 (const :tag "always indents, never inserts TAB" t)
71 (const :tag "indents in left margin, otherwise inserts TAB" nil) 85 (const :tag "indents in left margin, otherwise inserts TAB" nil)
72 (const :tag "inserts TAB in literals, otherwise indent" other)) 86 (other :tag "inserts TAB in literals, otherwise indent" other))
73 :group 'c) 87 :group 'c)
74 88
75 (defcustom c-insert-tab-function 'insert-tab 89 (defcustom c-insert-tab-function 'insert-tab
76 "*Function used when inserting a tab for \\[TAB]. 90 "*Function used when inserting a tab for \\[TAB].
77 Only used when `c-tab-always-indent' indicates a `real' tab character 91 Only used when `c-tab-always-indent' indicates a `real' tab character
127 only takes place when there is nothing but 141 only takes place when there is nothing but
128 white space between the braces and the `else'. 142 white space between the braces and the `else'.
129 Clean up occurs when the open-brace after the 143 Clean up occurs when the open-brace after the
130 `else' is typed. 144 `else' is typed.
131 brace-elseif-brace -- similar to brace-else-brace, but cleans up 145 brace-elseif-brace -- similar to brace-else-brace, but cleans up
132 `} else if {' constructs. 146 `} else if (...) {' constructs. Clean up occurs
147 both after the open parenthesis and after the
148 open brace.
149 brace-catch-brace -- similar to brace-elseif-brace, but cleans up
150 `} catch (...) {' constructs.
133 empty-defun-braces -- cleans up empty defun braces by placing the 151 empty-defun-braces -- cleans up empty defun braces by placing the
134 braces on the same line. Clean up occurs when 152 braces on the same line. Clean up occurs when
135 the defun closing brace is typed. 153 the defun closing brace is typed.
136 defun-close-semi -- cleans up the terminating semi-colon on defuns 154 defun-close-semi -- cleans up the terminating semi-colon on defuns
137 by placing the semi-colon on the same line as 155 by placing the semi-colon on the same line as
148 whitespace between colons. Clean up occurs 166 whitespace between colons. Clean up occurs
149 when the second colon is typed." 167 when the second colon is typed."
150 :type '(set 168 :type '(set
151 :extra-offset 8 169 :extra-offset 8
152 (const :tag "Put `} else {' on one line" brace-else-brace) 170 (const :tag "Put `} else {' on one line" brace-else-brace)
153 (const :tag "Put `} else if {' on one line" brace-elseif-brace) 171 (const :tag "Put `} else if (...) {' on one line" brace-elseif-brace)
172 (const :tag "Put `} catch (...) {' on one line" brace-catch-brace)
154 (const :tag "Put empty defun braces on one line" empty-defun-braces) 173 (const :tag "Put empty defun braces on one line" empty-defun-braces)
155 (const :tag "Put `},' in aggregates on one line" list-close-comma) 174 (const :tag "Put `},' in aggregates on one line" list-close-comma)
156 (const :tag "Put C++ style `::' on one line" scope-operator)) 175 (const :tag "Put C++ style `::' on one line" scope-operator))
157 :group 'c) 176 :group 'c)
158 177
159 (defcustom c-hanging-braces-alist '((brace-list-open) 178 (defcustom c-hanging-braces-alist '((brace-list-open)
179 (brace-entry-open)
160 (substatement-open after) 180 (substatement-open after)
161 (block-close . c-snug-do-while) 181 (block-close . c-snug-do-while)
162 (extern-lang-open after) 182 (extern-lang-open after)
183 (inexpr-class-open after)
184 (inexpr-class-close before)
163 ) 185 )
164 "*Controls the insertion of newlines before and after braces. 186 "*Controls the insertion of newlines before and after braces.
165 This variable contains an association list with elements of the 187 This variable contains an association list with elements of the
166 following form: (SYNTACTIC-SYMBOL . ACTION). 188 following form: (SYNTACTIC-SYMBOL . ACTION).
167 189
173 195
174 SYNTACTIC-SYMBOL can be any of: defun-open, defun-close, class-open, 196 SYNTACTIC-SYMBOL can be any of: defun-open, defun-close, class-open,
175 class-close, inline-open, inline-close, block-open, block-close, 197 class-close, inline-open, inline-close, block-open, block-close,
176 substatement-open, statement-case-open, extern-lang-open, 198 substatement-open, statement-case-open, extern-lang-open,
177 extern-lang-close, brace-list-open, brace-list-close, 199 extern-lang-close, brace-list-open, brace-list-close,
178 brace-list-intro, or brace-list-entry. See `c-offsets-alist' for 200 brace-list-intro, brace-entry-open, inexpr-class-open, or
179 details. 201 inexpr-class-close. See `c-offsets-alist' for details, except for
202 inexpr-class-open and inexpr-class-close, which doesn't have any
203 corresponding symbols there. Those two symbols are used for the
204 opening and closing braces, respectively, of anonymous inner classes
205 in Java.
180 206
181 ACTION can be either a function symbol or a list containing any 207 ACTION can be either a function symbol or a list containing any
182 combination of the symbols `before' or `after'. If the list is empty, 208 combination of the symbols `before' or `after'. If the list is empty,
183 no newlines are inserted either before or after the brace. 209 no newlines are inserted either before or after the brace.
184 210
196 (const inline-open) (const inline-close) 222 (const inline-open) (const inline-close)
197 (const block-open) (const block-close) 223 (const block-open) (const block-close)
198 (const substatement-open) (const statement-case-open) 224 (const substatement-open) (const statement-case-open)
199 (const extern-lang-open) (const extern-lang-close) 225 (const extern-lang-open) (const extern-lang-close)
200 (const brace-list-open) (const brace-list-close) 226 (const brace-list-open) (const brace-list-close)
201 (const brace-list-intro) (const brace-list-entry)) 227 (const brace-list-intro) (const brace-entry-open)
228 (const inexpr-class-open) (const inexpr-class-close))
202 (choice :tag "Action" 229 (choice :tag "Action"
203 (set :format "Insert a newline %v" 230 (set :format "Insert a newline %v"
204 :extra-offset 38 231 :extra-offset 38
205 (const :tag "before brace" before) 232 (const :tag "before brace" before)
206 (const :tag "after brace" after)) 233 (const :tag "after brace" after))
308 this variable to nil." 335 this variable to nil."
309 :type 'integer 336 :type 'integer
310 :group 'c) 337 :group 'c)
311 338
312 (defcustom c-default-style "gnu" 339 (defcustom c-default-style "gnu"
313 "*Style which gets installed by default. 340 "*Style which gets installed by default when a file is visited.
314 341
315 The value of this variable can be any style defined in 342 The value of this variable can be any style defined in
316 `c-style-alist', including styles you add, if you add them before CC 343 `c-style-alist', including styles you add. The value can also be an
317 Mode gets initialized. Note that if you set any CC Mode variables in 344 association list of major mode symbols to style names.
318 the top-level of your .emacs file (i.e. *not* in a hook), these get 345
319 incorporated into the `user' style so you would need to add: 346 When the value is a string, all CC Mode major modes will install this
320 347 style by default, except `java-mode', which always installs the
321 (setq c-default-style \"user\") 348 \"java\" style (this is for backwards compatibility).
349
350 When the value is an alist, the named style is installed. If the
351 major mode is not listed in the alist, then the symbol `other' is
352 looked up in the alist, and if found, the associated style is used.
353 If `other' is not found in the alist, then \"gnu\" style is used.
354
355 Note that if you set any CC Mode variables in the top-level of your
356 .emacs file (i.e. *not* in a hook), these get incorporated into the
357 `user' style, so you would need to add:
358
359 (setq c-default-style '((other . \"user\")))
322 360
323 to see your customizations. This is also true if you use the Custom 361 to see your customizations. This is also true if you use the Custom
324 interface -- be sure to set the default style to `user'." 362 interface -- be sure to set the default style to `user'.
325 :type 'string 363
364 Finally, the default style gets installed before your mode hooks run,
365 so you can always override the use of `c-default-style' by making
366 calls to `c-set-style' in the appropriate mode hook."
367 :type '(choice string
368 (repeat :tag "" :menu-tag "Major mode list"
369 (cons :tag ""
370 (choice :tag "Mode"
371 (const c-mode) (const c++-mode) (const objc-mode)
372 (const java-mode) (const idl-mode)
373 (const pike-mode) (const other))
374 (string :tag "Style")
375 )))
326 :group 'c) 376 :group 'c)
327 377
328 (defcustom c-style-variables-are-local-p nil 378 (defcustom c-style-variables-are-local-p nil
329 "*Whether style variables should be buffer local by default. 379 "*Whether style variables should be buffer local by default.
330 If non-nil, then all indentation style related variables will be made 380 If non-nil, then all indentation style related variables will be made
385 This hook is only run once per Emacs session and can be used as a 435 This hook is only run once per Emacs session and can be used as a
386 `load-hook' or in place of using `eval-after-load'." 436 `load-hook' or in place of using `eval-after-load'."
387 :type 'hook 437 :type 'hook
388 :group 'c) 438 :group 'c)
389 439
390 (defcustom c-enable-xemacs-performance-kludge-p t 440 (defcustom c-enable-xemacs-performance-kludge-p nil
391 "*Enables a XEmacs only hack that may improve speed for some coding styles. 441 "*Enables a XEmacs only hack that may improve speed for some coding styles.
392 For styles that hang top-level opening braces (as is common with JDK 442 For styles that hang top-level opening braces (as is common with JDK
393 Java coding styles) this can improve performance between 3 and 60 443 Java coding styles) this can improve performance between 3 and 60
394 times for core indentation functions (e.g. `c-parse-state'). For 444 times for core indentation functions (e.g. `c-parse-state'). For
395 styles that conform to the Emacs recommendation of putting these 445 styles that conform to the Emacs recommendation of putting these
396 braces in column zero, this may slightly degrade performance in some 446 braces in column zero, this can degrade performance about as much.
397 situations, but only by a few percentage points. This variable only 447 This variable only has effect in XEmacs.")
398 has effect in XEmacs.")
399 448
400 449
401 ;; Non-customizable variables, still part of the interface to CC Mode 450 ;; Non-customizable variables, still part of the interface to CC Mode
402 (defvar c-file-style nil 451 (defvar c-file-style nil
403 "Variable interface for setting style via File Local Variables. 452 "Variable interface for setting style via File Local Variables.