]> code.delx.au - gnu-emacs/blobdiff - lisp/cedet/semantic/db-global.el
Merge from emacs-23; up to 2010-06-01T01:49:15Z!monnier@iro.umontreal.ca
[gnu-emacs] / lisp / cedet / semantic / db-global.el
index b32255e7f1b8de2bd655c3bf60a601ecdabf9d69..7f3d616203e581660ffd43e94f8f146a2e2863c2 100644 (file)
@@ -1,7 +1,6 @@
 ;;; semantic/db-global.el --- Semantic database extensions for GLOBAL
 
-;;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008, 2009
-;;; Free Software Foundation, Inc.
+;; Copyright (C) 2002-2006, 2008-2011  Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Keywords: tags
@@ -40,9 +39,6 @@
 
 ;;; Code:
 
-(declare-function data-debug-new-buffer "data-debug")
-(declare-function data-debug-insert-thing result "data-debug")
-
 ;;;###autoload
 (defun semanticdb-enable-gnu-global-databases (mode)
   "Enable the use of the GNU Global SemanticDB back end for all files of MODE.
@@ -50,7 +46,7 @@ This will add an instance of a GNU Global database to each buffer
 in a GNU Global supported hierarchy."
   (interactive
    (list (completing-read
-          "Emable in Mode: " obarray
+          "Enable in Mode: " obarray
           #'(lambda (s) (get s 'mode-local-symbol-table))
           t (symbol-name major-mode))))
 
@@ -61,15 +57,15 @@ in a GNU Global supported hierarchy."
   (when (stringp mode)
     (setq mode (intern mode)))
 
-  (let ((ih (mode-local-value mode 'semantic-init-mode-hooks)))
+  (let ((ih (mode-local-value mode 'semantic-init-mode-hook)))
     (eval `(setq-mode-local
-           ,mode semantic-init-mode-hooks
+           ,mode semantic-init-mode-hook
            (cons 'semanticdb-enable-gnu-global-hook ih))))
 
   )
 
 (defun semanticdb-enable-gnu-global-hook ()
-  "Add support for GNU Global in the current buffer via semantic-init-hook.
+  "Add support for GNU Global in the current buffer via `semantic-init-hook'.
 MODE is the major mode to support."
   (semanticdb-enable-gnu-global-in-buffer t))
 
@@ -81,8 +77,8 @@ MODE is the major mode to support."
 
 (defun semanticdb-enable-gnu-global-in-buffer (&optional dont-err-if-not-available)
   "Enable a GNU Global database in the current buffer.
-Argument DONT-ERR-IF-NOT-AVAILABLE will throw an error if GNU Global
-is not available for this directory."
+When GNU Global is not available for this directory, display a message
+if optional DONT-ERR-IF-NOT-AVAILABLE is non-nil; else throw an error."
   (interactive "P")
   (if (cedet-gnu-global-root)
       (setq
@@ -96,7 +92,7 @@ is not available for this directory."
               '(omniscience))
        )
     (if dont-err-if-not-available
-       (message "No Global support in %s" default-directory)
+       nil; (message "No Global support in %s" default-directory)
       (error "No Global support in %s" default-directory))
     ))
 
@@ -108,7 +104,7 @@ is not available for this directory."
 
 (defmethod semanticdb-equivalent-mode ((table semanticdb-table-global) &optional buffer)
   "Return t, pretend that this table's mode is equivalent to BUFFER.
-Equivalent modes are specified by by `semantic-equivalent-major-modes'
+Equivalent modes are specified by the `semantic-equivalent-major-modes'
 local variable."
   ;; @todo - hack alert!
   t)
@@ -162,7 +158,6 @@ Return a list of tags."
 Optional argument TAGS is a list of tags to search.
 Return a list of tags."
   (if tags (call-next-method)
-    ;; YOUR IMPLEMENTATION HERE
     (let* ((semantic-symref-tool 'global)
           (result (semantic-symref-find-tags-by-regexp regex 'project))
           )
@@ -172,7 +167,7 @@ Return a list of tags."
 
 (defmethod semanticdb-find-tags-for-completion-method
   ((table semanticdb-table-global) prefix &optional tags)
-  "In TABLE, find all occurances of tags matching PREFIX.
+  "In TABLE, find all occurrences of tags matching PREFIX.
 Optional argument TAGS is a list of tags to search.
 Returns a table of all matching tags."
   (if tags (call-next-method)
@@ -199,7 +194,7 @@ Returns a table of all matching tags."
 (defmethod semanticdb-deep-find-tags-by-name-method
   ((table semanticdb-table-global) name &optional tags)
   "Find all tags name NAME in TABLE.
-Optional argument TAGS is a list of tags t
+Optional argument TAGS is a list of tags to search.
 Like `semanticdb-find-tags-by-name-method' for global."
   (semanticdb-find-tags-by-name-method table name tags))
 
@@ -212,48 +207,15 @@ Like `semanticdb-find-tags-by-name-method' for global."
 
 (defmethod semanticdb-deep-find-tags-for-completion-method
   ((table semanticdb-table-global) prefix &optional tags)
-  "In TABLE, find all occurances of tags matching PREFIX.
+  "In TABLE, find all occurrences of tags matching PREFIX.
 Optional argument TAGS is a list of tags to search.
 Like `semanticdb-find-tags-for-completion-method' for global."
   (semanticdb-find-tags-for-completion-method table prefix tags))
 
-;;; TEST
-;;
-;; Here is a testing fcn to try out searches via the GNU Global database.
-(defvar semanticdb-test-gnu-global-startfile "~/src/global-5.7.3/global/global.c"
-  "File to use for testing.")
-
-(defun semanticdb-test-gnu-global (searchfor &optional standardfile)
-  "Test the GNU Global semanticdb.
-Argument SEARCHFOR is the text to search for.
-If optional arg STANDARDFILE is non nil, use a standard file w/ global enabled."
-  (interactive "sSearch For Tag: \nP")
-
-  (require 'data-debug)
-  (save-excursion
-    (when standardfile
-      (set-buffer (find-file-noselect semanticdb-test-gnu-global-startfile)))
-
-    (condition-case err
-       (semanticdb-enable-gnu-global-in-buffer)
-      (error (if standardfile
-                (error err)
-              (set-buffer (find-file-noselect semanticdb-test-gnu-global-startfile))
-              (semanticdb-enable-gnu-global-in-buffer))))
-
-    (let* ((db (semanticdb-project-database-global "global"))
-          (tab (semanticdb-file-table db (buffer-file-name)))
-          (result (semanticdb-deep-find-tags-for-completion-method tab searchfor))
-          )
-      (data-debug-new-buffer "*SemanticDB Gnu Global Result*")
-      (data-debug-insert-thing result "?" "")
-      )))
-
 (provide 'semantic/db-global)
 
 ;; Local variables:
 ;; generated-autoload-file: "loaddefs.el"
-;; generated-autoload-feature: semantic/loaddefs
 ;; generated-autoload-load-name: "semantic/db-global"
 ;; End: