]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/cc-styles.el
Add 2010 to copyright years.
[gnu-emacs] / lisp / progmodes / cc-styles.el
index 1ffcb170ca3f230df1de826f83e775d74b95e6c5..ec9ffe346244c6a9f35fb3e330da79958f5c6cac 100644 (file)
@@ -1,13 +1,14 @@
 ;;; cc-styles.el --- support for styles in CC Mode
 
 ;; Copyright (C) 1985, 1987, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-;;   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+;;   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
 ;;   Free Software Foundation, Inc.
 
 ;; Authors:    2004- 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)
 
 ;; 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 +28,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:
 
@@ -58,7 +57,8 @@
   '(("gnu"
      (c-basic-offset . 2)
      (c-comment-only-line-offset . (0 . 0))
-     (c-hanging-braces-alist     . ((substatement-open before after)))
+     (c-hanging-braces-alist     . ((substatement-open before after)
+                                   (arglist-cont-nonempty)))
      (c-offsets-alist . ((statement-block-intro . +)
                         (knr-argdecl-intro . 5)
                         (substatement-open . +)
     ("ellemtel"
      (c-basic-offset . 3)
      (c-comment-only-line-offset . 0)
-     (c-hanging-braces-alist     . ((substatement-open before after)))
+     (c-hanging-braces-alist     . ((substatement-open before after)
+                                   (arglist-cont-nonempty)))
      (c-offsets-alist . ((topmost-intro        . 0)
                         (substatement         . +)
                         (substatement-open    . 0)
                          (case-label           . +)
                          (access-label         . -)
-                         (inclass              . ++)
+                        (inclass              . +)
                         (inline-open          . 0))))
-
     ("linux"
      (c-basic-offset  . 8)
      (c-comment-only-line-offset . 0)
      (c-hanging-braces-alist . ((brace-list-open)
                                (brace-entry-open)
                                (substatement-open after)
-                               (block-close . c-snug-do-while)))
+                               (block-close . c-snug-do-while)
+                               (arglist-cont-nonempty)))
      (c-cleanup-list . (brace-else-brace))
      (c-offsets-alist . ((statement-block-intro . +)
                         (knr-argdecl-intro     . 0)
                                (brace-list-close)
                                (brace-entry-open)
                                (substatement-open after)
-                               (block-close . c-snug-do-while)))
+                               (block-close . c-snug-do-while)
+                               (arglist-cont-nonempty)))
      (c-block-comment-prefix . ""))
 
     ("java"
      (c-hanging-braces-alist . ((defun-open after)
                                (defun-close . c-snug-1line-defun-close)
                                (substatement-open after)
-                               (block-close . c-snug-do-while)))
+                               (block-close . c-snug-do-while)
+                               (arglist-cont-nonempty)))
      (c-hanging-semi&comma-criteria . nil)
      (c-cleanup-list . nil)            ; You might want one-liner-defun here.
      (c-offsets-alist . ((statement-block-intro . +)
@@ -418,7 +421,7 @@ STYLE using `c-set-style' if the optional SET-P flag is non-nil."
 
 (defun c-read-offset (langelem)
   ;; read new offset value for LANGELEM from minibuffer. return a
-  ;; legal value only
+  ;; valid value only
   (let* ((oldoff  (cdr-safe (or (assq langelem c-offsets-alist)
                                (assq langelem (get 'c-offsets-alist
                                                    'c-stylevar-fallback)))))
@@ -508,14 +511,21 @@ variables."
                          (assoc 'other c-comment-prefix-regexp)))
          c-comment-prefix-regexp))
 
-  (let ((comment-line-prefix
-        (concat "[ \t]*\\(" c-current-comment-prefix "\\)[ \t]*")))
-
-    (setq paragraph-start (concat comment-line-prefix
+  (let* ((empty-is-prefix (string-match c-current-comment-prefix ""))
+        (nonws-comment-line-prefix
+         (concat "\\(" c-current-comment-prefix "\\)[ \t]*"))
+        (comment-line-prefix (concat "[ \t]*" nonws-comment-line-prefix))
+        (blank-or-comment-line-prefix
+         (concat "[ \t]*"
+                 (if empty-is-prefix "" "\\(")
+                 nonws-comment-line-prefix
+                 (if empty-is-prefix "" "\\)?"))))
+
+    (setq paragraph-start (concat blank-or-comment-line-prefix
                                  c-paragraph-start
                                  "\\|"
                                  page-delimiter)
-         paragraph-separate (concat comment-line-prefix
+         paragraph-separate (concat blank-or-comment-line-prefix
                                     c-paragraph-separate
                                     "\\|"
                                     page-delimiter)
@@ -550,7 +560,7 @@ variables."
        "[ \t\f]*\\\\?$")
   (setq c-sentence-end-with-esc-eol
        (concat "\\(\\(" (c-default-value-sentence-end) "\\)"
-               ;; N.B.:  "$" would be illegal when not enclosed like "\\($\\)".
+               ;; N.B.:  "$" would be invalid when not enclosed like "\\($\\)".
                "\\|" "[.?!][]\"')}]* ?\\\\\\($\\)[ \t\n]*"
                "\\)")))
 
@@ -648,5 +658,5 @@ any reason to call this function directly."
 \f
 (cc-provide 'cc-styles)
 
-;;; arch-tag: c764f61a-96ba-484a-a68f-101c0e9d5d2c
+;; arch-tag: c764f61a-96ba-484a-a68f-101c0e9d5d2c
 ;;; cc-styles.el ends here