]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/cc-styles.el
Convert consecutive FSF copyright years to ranges.
[gnu-emacs] / lisp / progmodes / cc-styles.el
index 7e3cf5e9305f6b27695049a6f6606e1f02dcdaf2..abc413f4d880351dee743b2efbbc3324121cd900 100644 (file)
@@ -1,25 +1,25 @@
 ;;; 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, 2008
+;; Copyright (C) 1985, 1987, 1992-2011
 ;;   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)
-;; 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 +27,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:
 
@@ -51,7 +49,6 @@
 
 ;; Silence the compiler.
 (cc-bytecomp-defvar adaptive-fill-first-line-regexp) ; Emacs
-(cc-bytecomp-obsolete-fun make-local-hook) ; Marked obsolete in Emacs 21.1.
 
 \f
 (defvar c-style-alist
     ("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              . ++)
-                        (inline-open          . 0)
-                        (arglist-cont-nonempty))))
-
+                        (inclass              . +)
+                        (inline-open          . 0))))
     ("linux"
      (c-basic-offset  . 8)
      (c-comment-only-line-offset . 0)
@@ -513,14 +509,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)
@@ -536,13 +539,12 @@ variables."
 
     (when (boundp 'adaptive-fill-first-line-regexp)
       ;; XEmacs adaptive fill mode doesn't have this.
-      (make-local-variable 'adaptive-fill-first-line-regexp)
-      (setq adaptive-fill-first-line-regexp
-           (concat "\\`" comment-line-prefix
-                   ;; Maybe we should incorporate the old value here,
-                   ;; but then we have to do all sorts of kludges to
-                   ;; deal with the \` and \' it probably contains.
-                   "\\'"))))
+      (set (make-local-variable 'adaptive-fill-first-line-regexp)
+           (concat "\\`" comment-line-prefix
+                   ;; Maybe we should incorporate the old value here,
+                   ;; but then we have to do all sorts of kludges to
+                   ;; deal with the \` and \' it probably contains.
+                   "\\'"))))
 
   ;; Set up the values for use in strings.  These are the default
   ;; paragraph-start/separate values, enhanced to accept escaped EOLs as
@@ -644,7 +646,7 @@ any reason to call this function directly."
     (mapc func varsyms)
     ;; Hooks must be handled specially
     (if this-buf-only-p
-       (make-local-hook 'c-special-indent-hook)
+       (if (featurep 'xemacs) (make-local-hook 'c-special-indent-hook))
       (with-no-warnings (make-variable-buffer-local 'c-special-indent-hook))
       (setq c-style-variables-are-local-p t))
     ))
@@ -653,5 +655,4 @@ any reason to call this function directly."
 \f
 (cc-provide 'cc-styles)
 
-;; arch-tag: c764f61a-96ba-484a-a68f-101c0e9d5d2c
 ;;; cc-styles.el ends here