Refill some long/short copyright headers.
[bpt/emacs.git] / lisp / progmodes / cc-vars.el
index 6110ab2..d2a5d11 100644 (file)
@@ -1,25 +1,24 @@
 ;;; 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
-;;   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.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -27,9 +26,7 @@
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with this program; see the file COPYING.  If not, write to
-;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
@@ -73,8 +70,28 @@ Useful as last item in a `choice' widget."
       :format "%t%n"
       :value 'other))
 
+;; The next defun will supersede c-const-symbol.
+(eval-and-compile
+  (defun c-constant-symbol (sym len)
+  "Create an uneditable symbol for customization buffers.
+SYM is the name of the symbol, LEN the length of the field (in
+characters) the symbol will be displayed in.  LEN must be big
+enough.
+
+This returns a (const ....) structure, suitable for embedding
+within a customization type."
+  (or (symbolp sym) (error "c-constant-symbol: %s is not a symbol" sym))
+  (let* ((name (symbol-name sym))
+        (l (length name))
+        (disp (concat name ":" (make-string (- len l 1) ?\ ))))
+    `(const
+      :size ,len
+      :format ,disp
+      :value ,sym))))
+
 (define-widget 'c-const-symbol 'item
-  "An uneditable lisp symbol."
+  "An uneditable lisp symbol.  This is obsolete -
+use c-constant-symbol instead."
   :value nil
   :tag "Symbol"
   :format "%t: %v\n%d"
@@ -266,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)
@@ -287,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)
 
@@ -305,6 +319,7 @@ e.g. `c-special-indent-hook'."
   :type 'boolean
   :group 'c)
 (make-variable-buffer-local 'c-syntactic-indentation)
+(put 'c-syntactic-indentation 'safe-local-variable 'booleanp)
 
 (defcustom c-syntactic-indentation-in-macros t
   "*Enable syntactic analysis inside macros.
@@ -323,6 +338,7 @@ countered easily by surrounding the statements by a block \(or even
 better with the \"do { ... } while \(0)\" trick)."
   :type 'boolean
   :group 'c)
+(put 'c-syntactic-indentation-in-macros 'safe-local-variable 'booleanp)
 
 (defcustom-c-stylevar c-comment-only-line-offset 0
   "*Extra offset for line which contains only the start of a comment.
@@ -405,9 +421,7 @@ in that case, i.e. as if \\[c-indent-command] was used instead."
     `(set ,@(mapcar
             (lambda (elt)
               `(cons :format "%v"
-                     (c-const-symbol :format "%v: "
-                                     :size 20
-                                     :value ,elt)
+                     ,(c-constant-symbol elt 20)
                      (choice
                       :format "%[Choice%] %v"
                       :value (column . nil)
@@ -435,7 +449,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
@@ -709,7 +723,8 @@ involve auto-newline inserted newlines:
                                               (module-open after)
                                               (composition-open after)
                                               (inexpr-class-open after)
-                                              (inexpr-class-close before))
+                                              (inexpr-class-close before)
+                                              (arglist-cont-nonempty))
   "*Controls the insertion of newlines before and after braces
 when the auto-newline feature is active.  This variable contains an
 association list with elements of the following form:
@@ -743,18 +758,15 @@ syntactic context for the brace line."
   `(set ,@(mapcar
           (lambda (elt)
             `(cons :format "%v"
-                   (c-const-symbol :format "%v: "
-                                   :size 20
-                                   :value ,elt)
+                   ,(c-constant-symbol elt 24)
                    (choice :format "%[Choice%] %v"
                            :value (before after)
                            (set :menu-tag "Before/after"
-                                :format "Newline %v brace\n"
-                                (const :format "%v, " before)
-                                (const :format "%v" after))
+                                :format "Newline  %v brace\n"
+                                (const :format "%v,  " before)
+                                (const :format "%v " after))
                            (function :menu-tag "Function"
-                                     :format "Run function: %v"
-                                     :value c-))))
+                                     :format "Run function: %v"))))
           '(defun-open defun-close
              class-open class-close
              inline-open inline-close
@@ -766,7 +778,8 @@ syntactic context for the brace line."
              namespace-open namespace-close
              module-open module-close
              composition-open composition-close
-             inexpr-class-open inexpr-class-close)))
+             inexpr-class-open inexpr-class-close
+             arglist-cont-nonempty)))
     :group 'c)
 
 (defcustom c-max-one-liner-length 80
@@ -790,11 +803,9 @@ currently not supported for this variable."
   `(set ,@(mapcar
           (lambda (elt)
             `(cons :format "%v"
-                   (c-const-symbol :format "%v: "
-                                   :size 20
-                                   :value ,elt)
-                   (set :format "Newline %v brace\n"
-                        (const :format "%v, " before)
+                   ,(c-constant-symbol elt 20)
+                   (set :format "Newline  %v  colon\n"
+                        (const :format "%v,  " before)
                         (const :format "%v" after))))
           '(case-label label access-label member-init-intro inher-intro)))
   :group 'c)
@@ -923,6 +934,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 behaviour 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.
@@ -1004,9 +1054,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.
@@ -1108,7 +1162,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)
@@ -1232,12 +1287,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.
@@ -1307,8 +1366,7 @@ Here is the current list of valid syntactic element symbols:
           (lambda (elt)
             `(cons :format "%v"
                    :value ,elt
-                   (c-const-symbol :format "%v: "
-                                   :size 25)
+                   ,(c-constant-symbol (car elt) 25)
                    (sexp :format "%v"
                          :validate
                          (lambda (widget)
@@ -1324,7 +1382,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.
@@ -1354,6 +1412,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
@@ -1524,7 +1583,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
@@ -1651,5 +1710,4 @@ It treats escaped EOLs as whitespace.")
 \f
 (cc-provide 'cc-vars)
 
-;;; arch-tag: d62e9a55-c9fe-409b-b5b6-050b6aa202c9
 ;;; cc-vars.el ends here