Merge changes from emacs-23 branch
[bpt/emacs.git] / lisp / progmodes / cc-fonts.el
index 69774b6..72703b9 100644 (file)
@@ -1,20 +1,20 @@
 ;;; cc-fonts.el --- font lock support for CC Mode
 
-;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
 ;; Authors:    2003- Alan Mackenzie
 ;;             2002- Martin Stjernholm
 ;; Maintainer: bug-cc-mode@gnu.org
 ;; Created:    07-Jan-2002
-;; 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
@@ -22,9 +22,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:
 
         (unless (face-property-instance oldface 'reverse)
           (invert-face newface)))))
 
+(defvar c-annotation-face (make-face 'c-annotation-face)
+  "Face used to highlight annotations in java-mode and other modes that may wish to use it.")
+(set-face-foreground 'c-annotation-face "blue")
+
 (eval-and-compile
   ;; We need the following functions during compilation since they're
   ;; called when the `c-lang-defconst' initializers are evaluated.
@@ -394,14 +396,14 @@ stuff.  Used on level 1 and higher."
            `(;; The stuff after #error and #warning is a message, so
              ;; fontify it as a string.
              ,@(when (c-lang-const c-cpp-message-directives)
-                 (let* ((re (c-make-keywords-re nil
+                 (let* ((re (c-make-keywords-re 'appendable ; nil
                               (c-lang-const c-cpp-message-directives)))
                         (re-depth (regexp-opt-depth re)))
                    `((,(concat noncontinued-line-end
                                (c-lang-const c-opt-cpp-prefix)
                                re
                                "\\s +\\(.*\\)$")
-                      ,(+ ncle-depth re-depth 1) font-lock-string-face))))
+                      ,(+ ncle-depth re-depth 1) font-lock-string-face t))))
 
              ;; Fontify filenames in #include <...> as strings.
              ,@(when (c-lang-const c-cpp-include-directives)
@@ -428,7 +430,8 @@ stuff.  Used on level 1 and higher."
                                   (progn
                                     (c-mark-<-as-paren beg)
                                     (c-mark->-as-paren end))
-                                (c-clear-char-property beg 'syntax-table)))
+                                ;; (c-clear-char-property beg 'syntax-table)
+                                (c-clear-char-property beg 'category)))
                             nil)))))))
 
              ;; #define.
@@ -1328,7 +1331,7 @@ on level 2 only and so aren't combined with `c-complex-decl-matchers'."
       ,@(when (c-lang-const c-recognize-<>-arglists)
          `(c-font-lock-<>-arglists))
 
-      ;; The first two rules here mostly find occurences that
+      ;; The first two rules here mostly find occurrences that
       ;; `c-font-lock-declarations' has found already, but not
       ;; declarations containing blocks in the type (see note below).
       ;; It's also useful to fontify these everywhere to show e.g. when
@@ -1539,6 +1542,9 @@ higher."
               '((c-fontify-types-and-refs ((c-promote-possible-types t))
                   (c-forward-keyword-clause 1)
                   (if (> (point) limit) (goto-char limit))))))))
+
+      ,@(when (c-major-mode-is 'java-mode)
+         `((eval . (list "\\<\\(@[a-zA-Z0-9]+\\)\\>" 1 c-annotation-face))))
       ))
 
 (c-lang-defconst c-matchers-1
@@ -2118,7 +2124,7 @@ need for `pike-font-lock-extra-types'.")
 
 (defun c-find-invalid-doc-markup (regexp limit)
   ;; Used to fontify invalid markup in doc comments after the correct
-  ;; ones have been fontified: Find the first occurence of REGEXP
+  ;; ones have been fontified: Find the first occurrence of REGEXP
   ;; between the point and LIMIT that only is fontified with
   ;; `c-doc-face-name'.  If a match is found then submatch 0 surrounds
   ;; the first char and t is returned, otherwise nil is returned.
@@ -2311,5 +2317,5 @@ need for `pike-font-lock-extra-types'.")
 ;; 2006-07-10:  awk-font-lock-keywords has been moved back to cc-awk.el.
 (cc-provide 'cc-fonts)
 
-;;; arch-tag: 2f65f405-735f-4da5-8d4b-b957844c5203
+;; arch-tag: 2f65f405-735f-4da5-8d4b-b957844c5203
 ;;; cc-fonts.el ends here