Mercurial > emacs
annotate lisp/cedet/semantic/db-global.el @ 104454:e4842bf0f303
lisp/cedet/semantic/symref/filter.el: New file.
lisp/cedet/semantic/idle.el (semantic-symref-hits-in-region): Require
semantic/symref/filter.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sat, 05 Sep 2009 21:09:25 +0000 |
parents | 902d22a2d922 |
children | d0d9dd0539ad |
rev | line source |
---|---|
104435
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1 ;;; semantic/db-global.el --- Semantic database extensions for GLOBAL |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
2 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
3 ;;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008, 2009 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
4 ;;; Free Software Foundation, Inc. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 ;; Author: Eric M. Ludlam <zappo@gnu.org> |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 ;; Keywords: tags |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
8 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
9 ;; This file is part of GNU Emacs. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
10 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
11 ;; GNU Emacs is free software: you can redistribute it and/or modify |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
12 ;; it under the terms of the GNU General Public License as published by |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 ;; the Free Software Foundation, either version 3 of the License, or |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
14 ;; (at your option) any later version. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
15 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
16 ;; GNU Emacs is distributed in the hope that it will be useful, |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 ;; GNU General Public License for more details. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
20 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
21 ;; You should have received a copy of the GNU General Public License |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
23 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
24 ;;; Commentary: |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
25 ;; |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
26 ;; Use GNU Global for by-name database searches. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
27 ;; |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
28 ;; This will work as an "omniscient" database for a given project. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
29 ;; |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
30 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
31 (require 'cedet-global) |
104441
902d22a2d922
cedet/semantic/db-debug.el: Don't require semantic/db-mode, since
Chong Yidong <cyd@stupidchicken.com>
parents:
104435
diff
changeset
|
32 (require 'semantic/db-find) |
104435
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
33 (require 'semantic/symref/global) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
34 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
35 (eval-when-compile |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
36 ;; For generic function searching. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
37 (require 'eieio) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
38 (require 'eieio-opt) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
39 ) |
104441
902d22a2d922
cedet/semantic/db-debug.el: Don't require semantic/db-mode, since
Chong Yidong <cyd@stupidchicken.com>
parents:
104435
diff
changeset
|
40 |
104435
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
41 ;;; Code: |
104441
902d22a2d922
cedet/semantic/db-debug.el: Don't require semantic/db-mode, since
Chong Yidong <cyd@stupidchicken.com>
parents:
104435
diff
changeset
|
42 |
902d22a2d922
cedet/semantic/db-debug.el: Don't require semantic/db-mode, since
Chong Yidong <cyd@stupidchicken.com>
parents:
104435
diff
changeset
|
43 (declare-function data-debug-new-buffer "data-debug") |
902d22a2d922
cedet/semantic/db-debug.el: Don't require semantic/db-mode, since
Chong Yidong <cyd@stupidchicken.com>
parents:
104435
diff
changeset
|
44 (declare-function data-debug-insert-thing result "data-debug") |
902d22a2d922
cedet/semantic/db-debug.el: Don't require semantic/db-mode, since
Chong Yidong <cyd@stupidchicken.com>
parents:
104435
diff
changeset
|
45 |
902d22a2d922
cedet/semantic/db-debug.el: Don't require semantic/db-mode, since
Chong Yidong <cyd@stupidchicken.com>
parents:
104435
diff
changeset
|
46 |
104435
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
47 (defun semanticdb-enable-gnu-global-databases (mode) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
48 "Enable the use of the GNU Global SemanticDB back end for all files of MODE. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
49 This will add an instance of a GNU Global database to each buffer |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 in a GNU Global supported hierarchy." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 (interactive |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 (list (completing-read |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 "Emable in Mode: " obarray |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 #'(lambda (s) (get s 'mode-local-symbol-table)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
55 t (symbol-name major-mode)))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
56 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
57 ;; First, make sure the version is ok. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
58 (cedet-gnu-global-version-check) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
59 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
60 ;; Make sure mode is a symbol. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
61 (when (stringp mode) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
62 (setq mode (intern mode))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
63 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
64 (let ((ih (mode-local-value mode 'semantic-init-mode-hooks))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 (eval `(setq-mode-local |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
66 ,mode semantic-init-mode-hooks |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
67 (cons 'semanticdb-enable-gnu-global-hook ih)))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
68 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
69 ) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
70 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
71 (defun semanticdb-enable-gnu-global-hook () |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
72 "Add support for GNU Global in the current buffer via semantic-init-hook. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
73 MODE is the major mode to support." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
74 (semanticdb-enable-gnu-global-in-buffer t)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
75 |
104441
902d22a2d922
cedet/semantic/db-debug.el: Don't require semantic/db-mode, since
Chong Yidong <cyd@stupidchicken.com>
parents:
104435
diff
changeset
|
76 (defclass semanticdb-project-database-global |
902d22a2d922
cedet/semantic/db-debug.el: Don't require semantic/db-mode, since
Chong Yidong <cyd@stupidchicken.com>
parents:
104435
diff
changeset
|
77 ;; @todo - convert to one DB per directory. |
902d22a2d922
cedet/semantic/db-debug.el: Don't require semantic/db-mode, since
Chong Yidong <cyd@stupidchicken.com>
parents:
104435
diff
changeset
|
78 (semanticdb-project-database eieio-instance-tracker) |
902d22a2d922
cedet/semantic/db-debug.el: Don't require semantic/db-mode, since
Chong Yidong <cyd@stupidchicken.com>
parents:
104435
diff
changeset
|
79 () |
902d22a2d922
cedet/semantic/db-debug.el: Don't require semantic/db-mode, since
Chong Yidong <cyd@stupidchicken.com>
parents:
104435
diff
changeset
|
80 "Database representing a GNU Global tags file.") |
902d22a2d922
cedet/semantic/db-debug.el: Don't require semantic/db-mode, since
Chong Yidong <cyd@stupidchicken.com>
parents:
104435
diff
changeset
|
81 |
104435
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 (defun semanticdb-enable-gnu-global-in-buffer (&optional dont-err-if-not-available) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
83 "Enable a GNU Global database in the current buffer. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
84 Argument DONT-ERR-IF-NOT-AVAILABLE will throw an error if GNU Global |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
85 is not available for this directory." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
86 (interactive "P") |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 (if (cedet-gnu-global-root) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 (setq |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
89 ;; Add to the system database list. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
90 semanticdb-project-system-databases |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
91 (cons (semanticdb-project-database-global "global") |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 semanticdb-project-system-databases) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 ;; Apply the throttle. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 semanticdb-find-default-throttle |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
95 (append semanticdb-find-default-throttle |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
96 '(omniscience)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
97 ) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 (if dont-err-if-not-available |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 (message "No Global support in %s" default-directory) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 (error "No Global support in %s" default-directory)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 )) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 ;;; Classes: |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 (defclass semanticdb-table-global (semanticdb-search-results-table) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 ((major-mode :initform nil) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 ) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 "A table for returning search results from GNU Global.") |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
109 (defmethod semanticdb-equivalent-mode ((table semanticdb-table-global) &optional buffer) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
110 "Return t, pretend that this table's mode is equivalent to BUFFER. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
111 Equivalent modes are specified by by `semantic-equivalent-major-modes' |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
112 local variable." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
113 ;; @todo - hack alert! |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
114 t) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
115 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
116 ;;; Filename based methods |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
117 ;; |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
118 (defmethod semanticdb-get-database-tables ((obj semanticdb-project-database-global)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
119 "For a global database, there are no explicit tables. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
120 For each file hit, get the traditional semantic table from that file." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
121 ;; We need to return something since there is always the "master table" |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
122 ;; The table can then answer file name type questions. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
123 (when (not (slot-boundp obj 'tables)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
124 (let ((newtable (semanticdb-table-global "GNU Global Search Table"))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
125 (oset obj tables (list newtable)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
126 (oset newtable parent-db obj) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
127 (oset newtable tags nil) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
128 )) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
129 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
130 (call-next-method)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
131 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
132 (defmethod semanticdb-file-table ((obj semanticdb-project-database-global) filename) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
133 "From OBJ, return FILENAME's associated table object." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
134 ;; We pass in "don't load". I wonder if we need to avoid that or not? |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
135 (car (semanticdb-get-database-tables obj)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
136 ) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
137 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
138 ;;; Search Overrides |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
139 ;; |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
140 ;; Only NAME based searches work with GLOBAL as that is all it tracks. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
141 ;; |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
142 (defmethod semanticdb-find-tags-by-name-method |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
143 ((table semanticdb-table-global) name &optional tags) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
144 "Find all tags named NAME in TABLE. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
145 Return a list of tags." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
146 (if tags |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
147 ;; If TAGS are passed in, then we don't need to do work here. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
148 (call-next-method) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
149 ;; Call out to GNU Global for some results. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
150 (let* ((semantic-symref-tool 'global) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
151 (result (semantic-symref-find-tags-by-name name 'project)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
152 ) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
153 (when result |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
154 ;; We could ask to keep the buffer open, but that annoys |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
155 ;; people. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
156 (semantic-symref-result-get-tags result)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
157 ))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
158 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
159 (defmethod semanticdb-find-tags-by-name-regexp-method |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
160 ((table semanticdb-table-global) regex &optional tags) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
161 "Find all tags with name matching REGEX in TABLE. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
162 Optional argument TAGS is a list of tags to search. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
163 Return a list of tags." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
164 (if tags (call-next-method) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
165 ;; YOUR IMPLEMENTATION HERE |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
166 (let* ((semantic-symref-tool 'global) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
167 (result (semantic-symref-find-tags-by-regexp regex 'project)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
168 ) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
169 (when result |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
170 (semantic-symref-result-get-tags result)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
171 ))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
172 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
173 (defmethod semanticdb-find-tags-for-completion-method |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
174 ((table semanticdb-table-global) prefix &optional tags) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
175 "In TABLE, find all occurances of tags matching PREFIX. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
176 Optional argument TAGS is a list of tags to search. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
177 Returns a table of all matching tags." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
178 (if tags (call-next-method) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
179 (let* ((semantic-symref-tool 'global) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
180 (result (semantic-symref-find-tags-by-completion prefix 'project)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
181 (faketags nil) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
182 ) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
183 (when result |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
184 (dolist (T (oref result :hit-text)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
185 ;; We should look up each tag one at a time, but I'm lazy! |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
186 ;; Doing this may be good enough. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
187 (setq faketags (cons |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
188 (semantic-tag T 'function :faux t) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
189 faketags)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
190 ) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
191 faketags)))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
192 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
193 ;;; Deep Searches |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
194 ;; |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
195 ;; If your language does not have a `deep' concept, these can be left |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
196 ;; alone, otherwise replace with implementations similar to those |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
197 ;; above. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
198 ;; |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
199 (defmethod semanticdb-deep-find-tags-by-name-method |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
200 ((table semanticdb-table-global) name &optional tags) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
201 "Find all tags name NAME in TABLE. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
202 Optional argument TAGS is a list of tags t |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
203 Like `semanticdb-find-tags-by-name-method' for global." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
204 (semanticdb-find-tags-by-name-method table name tags)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
205 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
206 (defmethod semanticdb-deep-find-tags-by-name-regexp-method |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
207 ((table semanticdb-table-global) regex &optional tags) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
208 "Find all tags with name matching REGEX in TABLE. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
209 Optional argument TAGS is a list of tags to search. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
210 Like `semanticdb-find-tags-by-name-method' for global." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
211 (semanticdb-find-tags-by-name-regexp-method table regex tags)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
212 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
213 (defmethod semanticdb-deep-find-tags-for-completion-method |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
214 ((table semanticdb-table-global) prefix &optional tags) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
215 "In TABLE, find all occurances of tags matching PREFIX. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
216 Optional argument TAGS is a list of tags to search. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
217 Like `semanticdb-find-tags-for-completion-method' for global." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
218 (semanticdb-find-tags-for-completion-method table prefix tags)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
219 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
220 ;;; TEST |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
221 ;; |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
222 ;; Here is a testing fcn to try out searches via the GNU Global database. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
223 (defvar semanticdb-test-gnu-global-startfile "~/src/global-5.7.3/global/global.c" |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
224 "File to use for testing.") |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
225 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
226 (defun semanticdb-test-gnu-global (searchfor &optional standardfile) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
227 "Test the GNU Global semanticdb. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
228 Argument SEARCHFOR is the text to search for. |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
229 If optional arg STANDARDFILE is non nil, use a standard file w/ global enabled." |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
230 (interactive "sSearch For Tag: \nP") |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
231 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
232 (require 'data-debug) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
233 (save-excursion |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
234 (when standardfile |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
235 (set-buffer (find-file-noselect semanticdb-test-gnu-global-startfile))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
236 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
237 (condition-case err |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
238 (semanticdb-enable-gnu-global-in-buffer) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
239 (error (if standardfile |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
240 (error err) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
241 (set-buffer (find-file-noselect semanticdb-test-gnu-global-startfile)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
242 (semanticdb-enable-gnu-global-in-buffer)))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
243 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
244 (let* ((db (semanticdb-project-database-global "global")) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
245 (tab (semanticdb-file-table db (buffer-file-name))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
246 (result (semanticdb-deep-find-tags-for-completion-method tab searchfor)) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
247 ) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
248 (data-debug-new-buffer "*SemanticDB Gnu Global Result*") |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
249 (data-debug-insert-thing result "?" "") |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
250 ))) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
251 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
252 (provide 'semantic/db-global) |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
253 |
52067a6bf088
semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
254 ;;; semantic/db-global.el ends here |