]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/cc-menus.el
Rearranged the order in which the tag-*-match-p functions are defined,
[gnu-emacs] / lisp / progmodes / cc-menus.el
index 8eb10050d015687359ca9bea11eec89710739abb..3bdb456e05f1e04da8b58f61dd56a84daa9d8a67 100644 (file)
@@ -1,8 +1,9 @@
 ;;; cc-menus.el --- imenu support for CC Mode
 
-;; Copyright (C) 1985,1987,1992-1999 Free Software Foundation, Inc.
+;; Copyright (C) 1985,1987,1992-2001 Free Software Foundation, Inc.
 
-;; Authors:    1998-1999 Barry A. Warsaw and Martin Stjernholm
+;; Authors:    2000- Martin Stjernholm
+;;            1998-1999 Barry A. Warsaw and Martin Stjernholm
 ;;             1992-1997 Barry A. Warsaw
 ;;             1987 Dave Detlefs and Stewart Clamen
 ;;             1985 Richard M. Stallman
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; along with GNU Emacs; see the file COPYING.  If not, write to
+;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 ;; Boston, MA 02111-1307, USA.
 
+;;; Commentary:
+
+;;; Code:
+
 (eval-when-compile
   (let ((load-path
-        (if (and (boundp 'byte-compile-current-file)
-                 (stringp byte-compile-current-file))
-            (cons (file-name-directory byte-compile-current-file)
-                  load-path)
+        (if (and (boundp 'byte-compile-dest-file)
+                 (stringp byte-compile-dest-file))
+            (cons (file-name-directory byte-compile-dest-file) load-path)
           load-path)))
-    (load "cc-defs" nil t)))
+    (require 'cc-bytecomp)))
 
-;; Dummy definitions to shut up the compiler in case imenu doesn't exist.
-(defvar imenu-generic-expression)
-(defvar imenu-case-fold-search)
-(or (fboundp 'imenu-progress-message)
-    (defun imenu-progress-message (&rest args) nil))
+;; Try to pull in imenu if it exists.
+(condition-case nil
+    (require 'imenu)
+  (error nil))
 
-;; Try to pull in imenu.
-(eval-and-compile
-  (condition-case nil
-      (require 'imenu)
-    (error nil)))
+;; The things referenced in imenu, which we don't require.
+(cc-bytecomp-defvar imenu-case-fold-search)
+(cc-bytecomp-defvar imenu-generic-expression)
+(cc-bytecomp-defun imenu-progress-message)
 
 \f
 ;; imenu integration
@@ -108,9 +110,9 @@ A sample value might look like: `\\(_P\\|_PROTO\\)'.")
        "[^()]*"                               ; no parentheses before
        "[^a-zA-Z0-9_:<>~]"                    ; match any non-identifier char
        "\\([a-zA-Z_][a-zA-Z0-9_:<>~]*\\)"     ; match function name
-       "[ \t]*("                             ; see above, BUT
-       "[ \t]*\\([^ \t(*][^)]*\\)?)"          ; the arg list must not start
-       "[ \t]*[^ \t;(]"                       ; with an asterisk or parentheses
+       "\\([ \t\n]\\|\\\\\n\\)*("            ; see above, BUT the arg list
+       "\\([ \t\n]\\|\\\\\n\\)*\\([^ \t\n(*][^)]*\\)?)" ; must not start
+       "\\([ \t\n]\\|\\\\\n\\)*[^ \t\n;(]"    ; with an asterisk or parentheses
        ) 1)
     ;; Special case for definitions using phony prototype macros like:
     ;; `int main _PROTO( (int argc,char *argv[]) )'.
@@ -132,13 +134,13 @@ A sample value might look like: `\\(_P\\|_PROTO\\)'.")
      ,(concat
          "^"                                  ; beginning of line is required
          "\\(template[ \t]*<[^>]+>[ \t]*\\)?" ; there may be a `template <...>'
-         "class[ \t]+"
+         "\\(class\\|struct\\)[ \t]+"
          "\\("                                ; the string we want to get
          "[a-zA-Z0-9_]+"                      ; class name
-         "\\(<[^>]+>\\)?"                     ; possibly explicitely specialized
+         "\\(<[^>]+>\\)?"                     ; possibly explicitly specialized
          "\\)"
-         "[ \t\n]*[:{]"
-         ) 2))
+         "\\([ \t\n]\\|\\\\\n\\)*[:{]"
+         ) 3))
   "Imenu generic expression for C++ mode.  See `imenu-generic-expression'.")
  
 (defvar cc-imenu-c-generic-expression
@@ -412,5 +414,6 @@ Example:
        imenu-case-fold-search nil))
 
 \f
-(provide 'cc-menus)
+(cc-provide 'cc-menus)
+
 ;;; cc-menus.el ends here