Spelling fixes.
[bpt/emacs.git] / lisp / cedet / semantic / symref.el
index 16f351c..cbae9f8 100644 (file)
@@ -1,6 +1,6 @@
 ;;; semantic/symref.el --- Symbol Reference API
 
-;; Copyright (C) 2008, 2009  Free Software Foundation, Inc.
+;; Copyright (C) 2008-2011  Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <eric@siege-engine.com>
 
@@ -69,8 +69,9 @@
 (defvar ede-minor-mode)
 (declare-function data-debug-new-buffer "data-debug")
 (declare-function data-debug-insert-object-slots "eieio-datadebug")
-(declare-function ede-toplevel "ede/files")
+(declare-function ede-toplevel "ede/base")
 (declare-function ede-project-root-directory "ede/files")
+(declare-function ede-up-directory "ede/files")
 
 ;;; Code:
 (defvar semantic-symref-tool 'detect
@@ -98,16 +99,27 @@ is supported.
 
 If no tools are supported, then 'grep is assumed.")
 
+(defun semantic-symref-calculate-rootdir ()
+  "Calculate the root directory for a symref search.
+Start with and EDE project, or use the default directory."
+  (let* ((rootproj (when (and (featurep 'ede) ede-minor-mode)
+                    (ede-toplevel)))
+        (rootdirbase (if rootproj
+                         (ede-project-root-directory rootproj)
+                       default-directory)))
+    (if (and rootproj (condition-case nil
+                         ;; Hack for subprojects.
+                         (oref rootproj :metasubproject)
+                       (error nil)))
+       (ede-up-directory rootdirbase)
+      rootdirbase)))
+
 (defun semantic-symref-detect-symref-tool ()
   "Detect the symref tool to use for the current buffer."
   (if (not (eq semantic-symref-tool 'detect))
       semantic-symref-tool
     ;; We are to perform a detection for the right tool to use.
-    (let* ((rootproj (when (and (featurep 'ede) ede-minor-mode)
-                      (ede-toplevel)))
-          (rootdir (if rootproj
-                       (ede-project-root-directory rootproj)
-                     default-directory))
+    (let* ((rootdir (semantic-symref-calculate-rootdir))
           (tools semantic-symref-tool-alist))
       (while (and tools (eq semantic-symref-tool 'detect))
        (when (funcall (car (car tools)) rootdir)
@@ -167,7 +179,7 @@ to perform the search.  This was added for use by a test harness."
       (set tool-return inst))
     (prog1
        (setq semantic-symref-last-result result)
-      (when (interactive-p)
+      (when (called-interactively-p 'interactive)
        (semantic-symref-data-debug-last-result))))
   )
 
@@ -187,7 +199,7 @@ Returns an object of class `semantic-symref-result'."
         (result (semantic-symref-get-result inst)))
     (prog1
        (setq semantic-symref-last-result result)
-      (when (interactive-p)
+      (when (called-interactively-p 'interactive)
        (semantic-symref-data-debug-last-result))))
   )
 
@@ -207,7 +219,7 @@ Returns an object of class `semantic-symref-result'."
         (result (semantic-symref-get-result inst)))
     (prog1
        (setq semantic-symref-last-result result)
-      (when (interactive-p)
+      (when (called-interactively-p 'interactive)
        (semantic-symref-data-debug-last-result))))
   )
 
@@ -227,7 +239,7 @@ Returns an object of class `semantic-symref-result'."
         (result (semantic-symref-get-result inst)))
     (prog1
        (setq semantic-symref-last-result result)
-      (when (interactive-p)
+      (when (called-interactively-p 'interactive)
        (semantic-symref-data-debug-last-result))))
   )
 
@@ -247,7 +259,7 @@ Returns an object of class `semantic-symref-result'."
         (result (semantic-symref-get-result inst)))
     (prog1
        (setq semantic-symref-last-result result)
-      (when (interactive-p)
+      (when (called-interactively-p 'interactive)
        (semantic-symref-data-debug-last-result))))
   )
 
@@ -268,7 +280,7 @@ Returns an object of class `semantic-symref-result'."
         (result (semantic-symref-get-result inst)))
     (prog1
        (setq semantic-symref-last-result result)
-      (when (interactive-p)
+      (when (called-interactively-p 'interactive)
        (semantic-symref-data-debug-last-result))))
   )
 
@@ -312,7 +324,7 @@ Use the  `semantic-symref-hit-tags' method to get this list.")
       (setq ans (list (car files))
            files (cdr files))
       (dolist (F files)
-       ;; This algorithm for uniqing the file list depends on the
+       ;; This algorithm for uniquifying the file list depends on the
        ;; tool in question providing all the hits in the same file
        ;; grouped together.
        (when (not (string= F (car ans)))
@@ -493,9 +505,7 @@ over until it returns nil."
 
 ;; Local variables:
 ;; generated-autoload-file: "loaddefs.el"
-;; generated-autoload-feature: semantic/loaddefs
 ;; generated-autoload-load-name: "semantic/symref"
 ;; End:
 
-;; arch-tag: 928394b7-19ef-4f76-8cb3-37e9a9891984
 ;;; semantic/symref.el ends here