Update CEDET from upstream.
[bpt/emacs.git] / lisp / cedet / ede / cpp-root.el
index 5665d28..48b83f3 100644 (file)
@@ -1,6 +1,6 @@
 ;;; ede/cpp-root.el --- A simple way to wrap a C++ project with a single root
 
-;; Copyright (C) 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2012 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <eric@siege-engine.com>
 
@@ -21,7 +21,7 @@
 
 ;;; Commentary:
 ;;
-;; NOTE: ede-cpp-root.el has been commented so as to also make it
+;; NOTE: ede/cpp-root.el has been commented so as to also make it
 ;;       useful for learning how to make similar project types.
 ;;
 ;; Not everyone can use automake, or an EDE project type.  For
@@ -85,7 +85,7 @@
 ;;  file name for a header in your project where most of your CPP
 ;;  macros reside.  Doing this can be easier than listing everything in
 ;;  the :spp-table option.  The files listed in :spp-files should not
-;;  start with a /, and are relative to something in :include-path.;;
+;;  start with a /, and are relative to something in :include-path.
 ;;
 ;; If you want to override the file-finding tool with your own
 ;; function you can do this:
 ;;           :proj-file 'MY-FILE-FOR-DIR
 ;;            :proj-root 'MY-ROOT-FCN
 ;;           :load-type 'MY-LOAD
-;;           :class-sym 'ede-cpp-root)
+;;           :class-sym 'ede-cpp-root-project
+;;           :safe-p t)
 ;;          t)
 ;;
 ;;; TODO
@@ -238,16 +239,20 @@ ROOTPROJ is nil, since there is only one project."
   (ede-cpp-root-file-existing dir))
 
 ;;;###autoload
-(add-to-list 'ede-project-class-files
-            (ede-project-autoload "cpp-root"
-             :name "CPP ROOT"
-             :file 'ede/cpp-root
-             :proj-file 'ede-cpp-root-project-file-for-dir
-             :proj-root 'ede-cpp-root-project-root
-             :load-type 'ede-cpp-root-load
-             :class-sym 'ede-cpp-root
-             :new-p nil)
-            t)
+(ede-add-project-autoload
+ (ede-project-autoload "cpp-root"
+                      :name "CPP ROOT"
+                      :file 'ede-cpp-root
+                      :proj-file 'ede-cpp-root-project-file-for-dir
+                      :proj-root 'ede-cpp-root-project-root
+                      :load-type 'ede-cpp-root-load
+                      :class-sym 'ede-cpp-root
+                      :new-p nil
+                      :safe-p t)
+ ;; When a user creates one of these, it should override any other project
+ ;; type that might happen to be in this directory, so force this to the
+ ;; very front.
+ 'unique)
 
 ;;; CLASSES
 ;;
@@ -439,6 +444,7 @@ This knows details about or source tree."
            ;; Else, do the usual.
            (setq ans (call-next-method)))
          )))
+    ;; TODO - does this call-next-method happen twice.  Is that bad??  Why is it here?
     (or ans (call-next-method))))
 
 (defmethod ede-project-root ((this ede-cpp-root-project))
@@ -500,16 +506,16 @@ Also set up the lexical preprocessor map."
              (table (when expfile
                       (semanticdb-file-table-object expfile)))
              )
-        (when (not table)
-          (message "Cannot find file %s in project." F))
-        (when (and table (semanticdb-needs-refresh-p table))
-          (semanticdb-refresh-table table)
+        (if (not table)
+            (message "Cannot find file %s in project." F)
+          (when (semanticdb-needs-refresh-p table)
+            (semanticdb-refresh-table table))
           (setq spp (append spp (oref table lexical-table))))))
      (oref this spp-files))
     spp))
 
 (defmethod ede-system-include-path ((this ede-cpp-root-target))
-  "Get the system include path used by project THIS."
+  "Get the system include path used by target THIS."
   (ede-system-include-path (ede-target-parent this)))
 
 (defmethod ede-preprocessor-map ((this ede-cpp-root-target))
@@ -538,5 +544,4 @@ Note: This needs some work."
 ;; generated-autoload-load-name: "ede/cpp-root"
 ;; End:
 
-;; arch-tag: c3ac8160-cba6-447e-8b9c-accb7e2d942e
 ;;; ede/cpp-root.el ends here