Update CEDET from upstream.
[bpt/emacs.git] / lisp / cedet / ede / files.el
index 02aeffc..e5d7523 100644 (file)
@@ -63,7 +63,8 @@ the current EDE project."
   (interactive)
   (require 'ede/locate)
   (let* ((loc (ede-get-locator-object (ede-current-project))))
-    (ede-locate-flush-hash loc)))
+    (when loc
+      (ede-locate-flush-hash loc))))
 
 ;;; Placeholders for ROOT directory scanning on base objects
 ;;
@@ -110,7 +111,7 @@ of the anchor file for the project."
         (when (not ans)
           (if (equal (ede--project-inode SP) inode)
               (setq ans SP)
-            (ede-find-subproject-for-directory SP dir)))))
+            (setq ans (ede-find-subproject-for-directory SP dir))))))
       ans)))
 
 ;;; DIRECTORY IN OPEN PROJECT
@@ -219,6 +220,18 @@ Does not check subprojects."
                                    :test 'equal)
   "A hash of directory names and associated EDE objects.")
 
+(defun ede-flush-directory-hash ()
+  "Flush the project directory hash.
+Do this only when developing new projects that are incorrectly putting
+'nomatch tokens into the hash."
+  (interactive)
+  (setq ede-project-directory-hash (make-hash-table :test 'equal))
+  ;; Also slush the current project's locator hash.
+  (let ((loc (ede-get-locator-object ede-object)))
+    (when loc
+      (ede-locate-flush-hash loc)))
+  )
+
 (defun ede-project-directory-remove-hash (dir)
   "Reset the directory hash for DIR.
 Do this whenever a new project is created, as opposed to loaded."
@@ -368,10 +381,11 @@ Get it from the toplevel project.  If it doesn't have one, make one."
   ;; Make sure we have a location object available for
   ;; caching values, and for locating things more robustly.
   (let ((top (ede-toplevel proj)))
-    (when (not (slot-boundp top 'locate-obj))
-      (ede-enable-locate-on-project top))
-    (oref top locate-obj)
-    ))
+    (when top
+      (when (not (slot-boundp top 'locate-obj))
+       (ede-enable-locate-on-project top))
+      (oref top locate-obj)
+      )))
 
 (defmethod ede-expand-filename ((this ede-project) filename &optional force)
   "Return a fully qualified file name based on project THIS.