Spelling fixes.
[bpt/emacs.git] / lisp / progmodes / cc-vars.el
index 18f314c..02256ea 100644 (file)
@@ -1,18 +1,17 @@
 ;;; cc-vars.el --- user customization variables for CC Mode
 
-;; Copyright (C) 1985, 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-;;   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
-;;   Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2011  Free Software Foundation, Inc.
 
 ;; Authors:    2002- Alan Mackenzie
 ;;             1998- Martin Stjernholm
 ;;             1992-1999 Barry A. Warsaw
-;;             1987 Dave Detlefs and Stewart Clamen
+;;             1987 Dave Detlefs
+;;             1987 Stewart Clamen
 ;;             1985 Richard M. Stallman
 ;; Maintainer: bug-cc-mode@gnu.org
 ;; Created:    22-Apr-1997 (split from cc-mode.el)
-;; Version:    See cc-mode.el
-;; Keywords:   c languages oop
+;; Keywords:   c languages
+;; Package:    cc-mode
 
 ;; This file is part of GNU Emacs.
 
@@ -284,18 +283,13 @@ nil."
   "*Controls the operation of the TAB key.
 If t, hitting TAB always just indents the current line.  If nil, hitting
 TAB indents the current line if point is at the left margin or in the
-line's indentation, otherwise it inserts a `real' tab character \(see
-note\).  If some other value (not nil or t), then tab is inserted only
-within literals \(comments and strings), but the line is always
-reindented.
-
-Note: The value of `indent-tabs-mode' will determine whether a real
-tab character will be inserted, or the equivalent number of spaces.
-When inserting a tab, actually the function stored in the variable
-`c-insert-tab-function' is called.
-
-Note: indentation of lines containing only comments is also controlled
-by the `c-comment-only-line-offset' variable."
+line's indentation, otherwise it calls `c-insert-tab-function' to
+insert a `real' tab character.  If some other value (neither nil nor t),
+then inserts a tab only within literals (comments and strings), but
+always reindents the line.
+
+Note: the variable `c-comment-only-line-offset' also controls the
+indentation of lines containing only comments."
   :type '(radio
          (const :tag "TAB key always indents, never inserts TAB" t)
          (const :tag "TAB key indents in left margin, otherwise inserts TAB" nil)
@@ -305,7 +299,9 @@ by the `c-comment-only-line-offset' variable."
 (defcustom c-insert-tab-function 'insert-tab
   "*Function used when inserting a tab for \\[c-indent-command].
 Only used when `c-tab-always-indent' indicates a `real' tab character
-should be inserted.  Value must be a function taking no arguments."
+should be inserted.  Value must be a function taking no arguments.
+The default, `insert-tab', inserts either a tab or the equivalent
+number of spaces depending on the value of `indent-tabs-mode'."
   :type 'function
   :group 'c)
 
@@ -344,6 +340,20 @@ better with the \"do { ... } while \(0)\" trick)."
   :group 'c)
 (put 'c-syntactic-indentation-in-macros 'safe-local-variable 'booleanp)
 
+(defcustom c-defun-tactic 'go-outward
+  "*Whether functions are recognized inside, e.g., a class.
+This is used by `c-beginning-of-defun' and like functions.
+
+Its value is one of:
+ t           -- Functions are recognized only at the top level.
+ go-outward  -- Nested functions are also recognized.  Should a function
+                command hit the beginning/end of a nested scope, it will
+                carry on at the less nested level."
+  :type '(radio
+         (const :tag "Functions are at the top-level" t)
+         (const :tag "Functions are also recognized inside declaration scopes" go-outward))
+  :group 'c)
+
 (defcustom-c-stylevar c-comment-only-line-offset 0
   "*Extra offset for line which contains only the start of a comment.
 Can contain an integer or a cons cell of the form:
@@ -453,7 +463,7 @@ comment-only lines."
   :group 'c)
 
 (make-obsolete-variable 'c-comment-continuation-stars
-                       'c-block-comment-prefix)
+                       'c-block-comment-prefix "21.1")
 
 ;; Although c-comment-continuation-stars is obsolete, we look at it in
 ;; some places in CC Mode anyway, so make the compiler ignore it
@@ -938,6 +948,45 @@ this variable to nil."
   :type 'integer
   :group 'c)
 
+(defcustom c-objc-method-arg-min-delta-to-bracket 2
+  "*Minimum number of chars to the opening bracket.
+
+Consider this ObjC snippet:
+
+       [foo blahBlah: fred
+       |<-x->|barBaz: barney
+
+If `x' is less than this number then `c-lineup-ObjC-method-call-colons'
+will defer the indentation decision to the next function.  By default
+this is `c-lineup-ObjC-method-call', which would align it like:
+
+       [foo blahBlahBlah: fred
+            thisIsTooDamnLong: barney
+
+This behavior can be overridden by customizing the indentation of
+`objc-method-call-cont' in the \"objc\" style."
+  :type 'integer
+  :group 'c)
+
+(defcustom c-objc-method-arg-unfinished-offset 4
+  "*Offset relative to bracket if first selector is on a new line.
+
+    [aaaaaaaaa
+    |<-x->|bbbbbbb:  cccccc
+             ddddd: eeee];"
+  :type 'integer
+  :group 'c)
+
+(defcustom c-objc-method-parameter-offset 4
+  "*Offset for selector parameter on a new line (relative to first selector.
+
+    [aaaaaaa bbbbbbbbbb:
+            |<-x->|cccccccc
+                    ddd: eeee
+                   ffff: ggg];"
+  :type 'integer
+  :group 'c)
+
 (defcustom c-default-style '((java-mode . "java") (awk-mode . "awk")
                             (other . "gnu"))
   "*Style which gets installed by default when a file is visited.
@@ -1019,9 +1068,13 @@ can always override the use of `c-default-style' by making calls to
        ;; Anchor pos: Boi at the topmost intro line.
        (knr-argdecl           . 0)
        ;; Anchor pos: At the beginning of the first K&R argdecl.
-       (topmost-intro         . 0)
+       (topmost-intro        . 0)
        ;; Anchor pos: Bol at the last line of previous construct.
        (topmost-intro-cont    . c-lineup-topmost-intro-cont)
+       ;;Anchor pos: Bol at the topmost annotation line
+       (annotation-top-cont   .   0)
+       ;;Anchor pos: Bol at the topmost annotation line
+       (annotation-var-cont   .   +)
        ;; Anchor pos: Boi at the topmost intro line.
        (member-init-intro     . +)
        ;; Anchor pos: Boi at the func decl arglist open.
@@ -1123,7 +1176,8 @@ can always override the use of `c-default-style' by making calls to
        ;; Anchor pos: Boi.
        (objc-method-args-cont . c-lineup-ObjC-method-args)
        ;; Anchor pos: At the method start (always at boi).
-       (objc-method-call-cont . c-lineup-ObjC-method-call)
+       (objc-method-call-cont . (c-lineup-ObjC-method-call-colons
+                               c-lineup-ObjC-method-call +))
        ;; Anchor pos: At the open bracket.
        (extern-lang-open      . 0)
        (namespace-open        . 0)
@@ -1247,12 +1301,16 @@ Here is the current list of valid syntactic element symbols:
                            between them; in C++ and Java, throws declarations
                            and other things can appear in this context.
  knr-argdecl-intro      -- First line of a K&R C argument declaration.
- knr-argdecl            -- Subsequent lines in a K&R C argument declaration.
- topmost-intro          -- The first line in a topmost construct definition.
- topmost-intro-cont     -- Topmost definition continuation lines.
- member-init-intro      -- First line in a member initialization list.
- member-init-cont       -- Subsequent member initialization list lines.
- inher-intro            -- First line of a multiple inheritance list.
+ knr-argdecl           -- Subsequent lines in a K&R C argument declaration.
+ topmost-intro         -- The first line in a topmost construct definition.
+ topmost-intro-cont    -- Topmost definition continuation lines.
+ annotation-top-cont    -- Topmost definition continuation line where only
+                          annotations are on previous lines.
+ annotation-var-cont    -- A continuation of a C (or like) statement where
+                          only annotations are on previous lines.
+ member-init-intro     -- First line in a member initialization list.
+ member-init-cont      -- Subsequent member initialization list lines.
+ inher-intro           -- First line of a multiple inheritance list.
  inher-cont             -- Subsequent multiple inheritance lines.
  block-open             -- Statement block open brace.
  block-close            -- Statement block close brace.
@@ -1269,7 +1327,7 @@ Here is the current list of valid syntactic element symbols:
  statement-case-open    -- The first line in a case block starting with brace.
  substatement           -- The first line after an if/while/for/do/else.
  substatement-open      -- The brace that opens a substatement block.
- substatement-label     -- Labelled line after an if/while/for/do/else.
+ substatement-label     -- Labeled line after an if/while/for/do/else.
  case-label             -- A \"case\" or \"default\" label.
  access-label           -- C++ private/protected/public access label.
  label                  -- Any ordinary label.
@@ -1338,7 +1396,7 @@ Here is the current list of valid syntactic element symbols:
   '(defun-block-intro block-open block-close statement statement-cont
     statement-block-intro statement-case-intro statement-case-open
     substatement substatement-open substatement-label case-label label
-    do-while-closure else-clause catch-clause inlambda))
+    do-while-closure else-clause catch-clause inlambda annotation-var-cont))
 
 (defcustom c-style-variables-are-local-p t
   "*Whether style variables should be buffer local by default.
@@ -1368,6 +1426,7 @@ The list of variables to buffer localize are:
     c-special-indent-hook
     c-indentation-style"
   :type 'boolean
+  :safe 'booleanp
   :group 'c)
 
 (defcustom c-mode-hook nil
@@ -1538,7 +1597,7 @@ names)."))
   :group 'c)
 
 (defcustom java-font-lock-extra-types
-  (list (concat "[" c-upper "]\\sw*[" c-lower "]\\sw*"))
+  (list (concat "[" c-upper "]\\sw*[" c-lower "]\\sw"))
   (c-make-font-lock-extra-types-blurb "Java" "java-mode" (concat
 "For example, a value of (\"[" c-upper "]\\\\sw*[" c-lower "]\\\\sw*\") means
 capitalized words are treated as type names (the requirement for a
@@ -1563,6 +1622,54 @@ names)."))
 
 \f
 ;; Non-customizable variables, still part of the interface to CC Mode
+(defvar c-macro-with-semi-re nil
+  ;; Regular expression which matches a (#define'd) symbol whose expansion
+  ;; ends with a semicolon.
+  ;;
+  ;; This variable should be set by `c-make-macros-with-semi-re' rather than
+  ;; directly.
+)
+(make-variable-buffer-local 'c-macro-with-semi-re)
+
+(defun c-make-macro-with-semi-re ()
+  ;; Convert `c-macro-names-with-semicolon' into the regexp
+  ;; `c-macro-with-semi-re' (or just copy it if it's already a re).
+  (setq c-macro-with-semi-re
+       (and
+        c-opt-cpp-macro-define
+        (cond
+         ((stringp c-macro-names-with-semicolon)
+          (copy-sequence c-macro-names-with-semicolon))
+         ((consp c-macro-names-with-semicolon)
+          (concat
+           "\\<"
+           (regexp-opt c-macro-names-with-semicolon)
+           "\\>"))   ; N.B. the PAREN param of regexp-opt isn't supported by
+                     ; all XEmacsen.
+         ((null c-macro-names-with-semicolon)
+          nil)
+         (t (error "c-make-macro-with-semi-re: invalid \
+c-macro-names-with-semicolon: %s"
+                   c-macro-names-with-semicolon))))))
+
+(defvar c-macro-names-with-semicolon
+  '("Q_OBJECT" "Q_PROPERTY" "Q_DECLARE" "Q_ENUMS")
+  "List of #defined symbols whose expansion ends with a semicolon.
+Alternatively it can be a string, a regular expression which
+matches all such symbols.
+
+The \"symbols\" must be syntactically valid identifiers in the
+target language \(C, C++, Objective C), or \(as the case may be)
+the regular expression must match only valid identifiers.
+
+If you change this variable's value, call the function
+`c-make-macros-with-semi-re' to set the necessary internal
+variables.
+
+Note that currently \(2008-11-04) this variable is a prototype,
+and is likely to disappear or change its form soon.")
+(make-variable-buffer-local 'c-macro-names-with-semicolon)
+
 (defvar c-file-style nil
   "Variable interface for setting style via File Local Variables.
 In a file's Local Variable section, you can set this variable to a
@@ -1588,8 +1695,7 @@ as designated in the variable `c-file-style'.")
 ;; It isn't possible to specify a doc-string without specifying an
 ;; initial value with `defvar', so the following two variables have been
 ;; given doc-strings by setting the property `variable-documentation'
-;; directly.  C-h v will read this documentation only for versions of GNU
-;; Emacs from 22.1.  It's really good not to have an initial value for
+;; directly.  It's really good not to have an initial value for
 ;; variables like these that always should be dynamically bound, so it's
 ;; worth the inconvenience.
 
@@ -1665,5 +1771,4 @@ It treats escaped EOLs as whitespace.")
 \f
 (cc-provide 'cc-vars)
 
-;; arch-tag: d62e9a55-c9fe-409b-b5b6-050b6aa202c9
 ;;; cc-vars.el ends here