annotate lisp/cedet/semantic/db-global.el @ 110769:ca7895148434

Fix rnewspost.el comment typo.
author Glenn Morris <rgm@gnu.org>
date Mon, 04 Oct 2010 21:14:08 -0700
parents a5ad4f188e19
children 376148b31b5e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 105842
diff changeset
3 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010
105307
786c0adc17cc (data-debug-new-buffer, data-debug-insert-thing): Remove unneeded
Glenn Morris <rgm@gnu.org>
parents: 104513
diff changeset
4 ;; Free Software Foundation, Inc.
104435
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
104459
d0d9dd0539ad lisp/cedet/semantic/db-global.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104441
diff changeset
43 ;;;###autoload
104435
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
44 (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
45 "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
46 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
47 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
48 (interactive
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
49 (list (completing-read
105307
786c0adc17cc (data-debug-new-buffer, data-debug-insert-thing): Remove unneeded
Glenn Morris <rgm@gnu.org>
parents: 104513
diff changeset
50 "Enable in Mode: " obarray
104435
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
51 #'(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
52 t (symbol-name major-mode))))
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
53
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
54 ;; 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
55 (cedet-gnu-global-version-check)
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 ;; 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
58 (when (stringp mode)
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
59 (setq mode (intern mode)))
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
60
104513
a6a812dd2d88 * cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 104493
diff changeset
61 (let ((ih (mode-local-value mode 'semantic-init-mode-hook)))
104435
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
62 (eval `(setq-mode-local
104513
a6a812dd2d88 * cedet/semantic/lex.el (semantic-lex-reset-hooks): Doc fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 104493
diff changeset
63 ,mode semantic-init-mode-hook
104435
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
64 (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
65
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
66 )
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
67
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
68 (defun semanticdb-enable-gnu-global-hook ()
106895
181539c8b6a4 Fix typos in docstrings, error messages, etc.
Juanma Barranquero <lekktu@gmail.com>
parents: 106860
diff changeset
69 "Add support for GNU Global in the current buffer via `semantic-init-hook'.
104435
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
70 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
71 (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
72
104441
902d22a2d922 cedet/semantic/db-debug.el: Don't require semantic/db-mode, since
Chong Yidong <cyd@stupidchicken.com>
parents: 104435
diff changeset
73 (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
74 ;; @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
75 (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
76 ()
902d22a2d922 cedet/semantic/db-debug.el: Don't require semantic/db-mode, since
Chong Yidong <cyd@stupidchicken.com>
parents: 104435
diff changeset
77 "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
78
104435
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
79 (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
80 "Enable a GNU Global database in the current buffer.
106895
181539c8b6a4 Fix typos in docstrings, error messages, etc.
Juanma Barranquero <lekktu@gmail.com>
parents: 106860
diff changeset
81 When GNU Global is not available for this directory, display a message
181539c8b6a4 Fix typos in docstrings, error messages, etc.
Juanma Barranquero <lekktu@gmail.com>
parents: 106860
diff changeset
82 if optional DONT-ERR-IF-NOT-AVAILABLE is non-nil; else throw an error."
104435
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
83 (interactive "P")
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
84 (if (cedet-gnu-global-root)
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
85 (setq
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
86 ;; 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
87 semanticdb-project-system-databases
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
88 (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
89 semanticdb-project-system-databases)
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
90 ;; Apply the throttle.
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
91 semanticdb-find-default-throttle
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
92 (append semanticdb-find-default-throttle
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
93 '(omniscience))
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
94 )
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
95 (if dont-err-if-not-available
110523
a5ad4f188e19 Synch Semantic to CEDET 1.0.
Chong Yidong <cyd@stupidchicken.com>
parents: 106895
diff changeset
96 nil; (message "No Global support in %s" default-directory)
104435
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
97 (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
98 ))
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
99
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
100 ;;; Classes:
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
101 (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
102 ((major-mode :initform nil)
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
103 )
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
104 "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
105
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
106 (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
107 "Return t, pretend that this table's mode is equivalent to BUFFER.
106860
4cf58c2379f4 Mario Lang <mlang@delysid.org>: Remove some duplicated words.
Glenn Morris <rgm@gnu.org>
parents: 106815
diff changeset
108 Equivalent modes are specified by the `semantic-equivalent-major-modes'
104435
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
109 local variable."
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
110 ;; @todo - hack alert!
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
111 t)
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
112
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
113 ;;; Filename based methods
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
114 ;;
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
115 (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
116 "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
117 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
118 ;; 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
119 ;; 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
120 (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
121 (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
122 (oset obj tables (list newtable))
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
123 (oset newtable parent-db obj)
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
124 (oset newtable tags nil)
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
125 ))
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
126
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
127 (call-next-method))
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 (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
130 "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
131 ;; 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
132 (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
133 )
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
134
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
135 ;;; Search Overrides
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 ;; 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
138 ;;
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
139 (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
140 ((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
141 "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
142 Return a list of tags."
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
143 (if tags
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
144 ;; 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
145 (call-next-method)
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
146 ;; 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
147 (let* ((semantic-symref-tool 'global)
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
148 (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
149 )
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
150 (when result
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
151 ;; 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
152 ;; people.
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
153 (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
154 )))
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
155
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
156 (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
157 ((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
158 "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
159 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
160 Return a list of tags."
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
161 (if tags (call-next-method)
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
162 (let* ((semantic-symref-tool 'global)
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
163 (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
164 )
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
165 (when result
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
166 (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
167 )))
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 (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
170 ((table semanticdb-table-global) prefix &optional tags)
106895
181539c8b6a4 Fix typos in docstrings, error messages, etc.
Juanma Barranquero <lekktu@gmail.com>
parents: 106860
diff changeset
171 "In TABLE, find all occurrences of tags matching PREFIX.
104435
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
172 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
173 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
174 (if tags (call-next-method)
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
175 (let* ((semantic-symref-tool 'global)
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
176 (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
177 (faketags nil)
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
178 )
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
179 (when result
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
180 (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
181 ;; 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
182 ;; 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
183 (setq faketags (cons
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
184 (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
185 faketags))
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
186 )
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
187 faketags))))
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
188
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
189 ;;; Deep Searches
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 ;; 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
192 ;; 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
193 ;; above.
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 (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
196 ((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
197 "Find all tags name NAME in TABLE.
106895
181539c8b6a4 Fix typos in docstrings, error messages, etc.
Juanma Barranquero <lekktu@gmail.com>
parents: 106860
diff changeset
198 Optional argument TAGS is a list of tags to search.
104435
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
199 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
200 (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
201
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
202 (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
203 ((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
204 "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
205 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
206 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
207 (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
208
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
209 (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
210 ((table semanticdb-table-global) prefix &optional tags)
106895
181539c8b6a4 Fix typos in docstrings, error messages, etc.
Juanma Barranquero <lekktu@gmail.com>
parents: 106860
diff changeset
211 "In TABLE, find all occurrences of tags matching PREFIX.
104435
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
212 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
213 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
214 (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
215
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
216 (provide 'semantic/db-global)
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
217
104459
d0d9dd0539ad lisp/cedet/semantic/db-global.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104441
diff changeset
218 ;; Local variables:
d0d9dd0539ad lisp/cedet/semantic/db-global.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104441
diff changeset
219 ;; generated-autoload-file: "loaddefs.el"
d0d9dd0539ad lisp/cedet/semantic/db-global.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104441
diff changeset
220 ;; generated-autoload-load-name: "semantic/db-global"
d0d9dd0539ad lisp/cedet/semantic/db-global.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104441
diff changeset
221 ;; End:
d0d9dd0539ad lisp/cedet/semantic/db-global.el: Add local vars for autoloading.
Chong Yidong <cyd@stupidchicken.com>
parents: 104441
diff changeset
222
105377
7f4c7f5c0eba Add arch tagline
Miles Bader <miles@gnu.org>
parents: 105307
diff changeset
223 ;; arch-tag: ec0edab2-26c2-438f-a3d2-0d953364f8cc
104435
52067a6bf088 semantic/cedet/db-global.el, semantic/cedet/ia-sb.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
224 ;;; semantic/db-global.el ends here