annotate lisp/cedet/semantic/db-find.el @ 104417:6810f0d84270

cedet/semantic/ctxt.el, cedet/semantic/db-find.el, cedet/semantic/db-ref.el, cedet/semantic/find.el, cedet/semantic/format.el, cedet/semantic/sort.el: New files.
author Chong Yidong <cyd@stupidchicken.com>
date Fri, 28 Aug 2009 19:18:35 +0000
parents
children da5b2513c225
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
104417
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1 ;;; db-find.el --- Searching through semantic databases.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
3 ;;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
4 ;;; 2008, 2009 Free Software Foundation, Inc.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
5
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
6 ;; Author: Eric M. Ludlam <zappo@gnu.org>
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
7 ;; Keywords: tags
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
8
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
10
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
13 ;; the Free Software Foundation, either version 3 of the License, or
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
14 ;; (at your option) any later version.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
15
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
19 ;; GNU General Public License for more details.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
20
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
23
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
24 ;;; Commentary:
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
25 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
26 ;; Databases of various forms can all be searched.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
27 ;; There are a few types of searches that can be done:
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
28 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
29 ;; Basic Name Search:
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
30 ;; These searches scan a database table collection for tags based
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
31 ;; on name.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
32 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
33 ;; Basic Attribute Search:
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
34 ;; These searches allow searching on specific attributes of tags,
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
35 ;; such as name, type, or other attribute.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
36 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
37 ;; Advanced Search:
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
38 ;; These are searches that were needed to accomplish some
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
39 ;; specialized tasks as discovered in utilities. Advanced searches
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
40 ;; include matching methods defined outside some parent class.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
41 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
42 ;; The reason for advanced searches are so that external
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
43 ;; repositories such as the Emacs obarray, or java .class files can
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
44 ;; quickly answer these needed questions without dumping the entire
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
45 ;; symbol list into Emacs for additional refinement searches via
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
46 ;; regular semanticdb search.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
47 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
48 ;; How databases are decided upon is another important aspect of a
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
49 ;; database search. When it comes to searching for a name, there are
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
50 ;; these types of searches:
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
51 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
52 ;; Basic Search:
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
53 ;; Basic search means that tags looking for a given name start
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
54 ;; with a specific search path. Names are sought on that path
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
55 ;; until it is empty or items on the path can no longer be found.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
56 ;; Use `semanticdb-dump-all-table-summary' to test this list.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
57 ;; Use `semanticdb-find-throttle-custom-list' to refine this list.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
58 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
59 ;; Deep Search:
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
60 ;; A deep search will search more than just the global namespace.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
61 ;; It will recurse into tags that contain more tags, and search
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
62 ;; those too.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
63 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
64 ;; Brute Search:
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
65 ;; Brute search means that all tables in all databases in a given
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
66 ;; project are searched. Brute searches are the search style as
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
67 ;; written for semantic version 1.x.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
68 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
69 ;; How does the search path work?
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
70 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
71 ;; A basic search starts with three parameters:
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
72 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
73 ;; (FINDME &optional PATH FIND-FILE-MATCH)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
74 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
75 ;; FINDME is key to be searched for dependent on the type of search.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
76 ;; PATH is an indicator of which tables are to be searched.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
77 ;; FIND-FILE-MATCH indicates that any time a match is found, the
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
78 ;; file associated with the tag should be read into a file.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
79 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
80 ;; The PATH argument is then the most interesting argument. It can
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
81 ;; have these values:
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
82 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
83 ;; nil - Take the current buffer, and use it's include list
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
84 ;; buffer - Use that buffer's include list.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
85 ;; filename - Use that file's include list. If the file is not
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
86 ;; in a buffer, see of there is a semanticdb table for it. If
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
87 ;; not, read that file into a buffer.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
88 ;; tag - Get that tag's buffer of file file. See above.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
89 ;; table - Search that table, and it's include list.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
90 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
91 ;; Search Results:
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
92 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
93 ;; Semanticdb returns the results in a specific format. There are a
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
94 ;; series of routines for using those results, and results can be
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
95 ;; passed in as a search-path for refinement searches with
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
96 ;; semanticdb. Apropos for semanticdb.*find-result for more.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
97 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
98 ;; Application:
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
99 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
100 ;; Here are applications where different searches are needed which
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
101 ;; exist as of semantic 1.4.x
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
102 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
103 ;; eldoc - popup help
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
104 ;; => Requires basic search using default path. (Header files ok)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
105 ;; tag jump - jump to a named tag
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
106 ;; => Requires a brute search useing whole project. (Source files only)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
107 ;; completion - Completing symbol names in a smart way
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
108 ;; => Basic search (headers ok)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
109 ;; type analysis - finding type definitions for variables & fcns
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
110 ;; => Basic search (headers ok)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
111 ;; Class browser - organize types into some structure
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
112 ;; => Brute search, or custom navigation.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
113
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
114 ;; TODO:
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
115 ;; During a search, load any unloaded DB files based on paths in the
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
116 ;; current project.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
117
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
118 (require 'semantic/db)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
119 (require 'semantic/db-ref)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
120 (eval-when-compile
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
121 (require 'eieio)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
122 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
123
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
124 ;;; Code:
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
125 (defvar semanticdb-find-throttle-custom-list
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
126 '(repeat (radio (const 'local)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
127 (const 'project)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
128 (const 'unloaded)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
129 (const 'system)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
130 (const 'recursive)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
131 (const 'omniscience)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
132 "Customization values for semanticdb find throttle.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
133 See `semanticdb-find-throttle' for details.")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
134
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
135 (defcustom semanticdb-find-default-throttle
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
136 '(local project unloaded system recursive)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
137 "The default throttle for `semanticdb-find' routines.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
138 The throttle controls how detailed the list of database
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
139 tables is for a symbol lookup. The value is a list with
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
140 the following keys:
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
141 `file' - The file the search is being performed from.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
142 This option is here for completeness only, and
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
143 is assumed to always be on.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
144 `local' - Tables from the same local directory are included.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
145 This includes files directly referenced by a file name
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
146 which might be in a different directory.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
147 `project' - Tables from the same local project are included
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
148 If `project' is specified, then `local' is assumed.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
149 `unloaded' - If a table is not in memory, load it. If it is not cached
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
150 on disk either, get the source, parse it, and create
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
151 the table.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
152 `system' - Tables from system databases. These are specifically
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
153 tables from system header files, or language equivalent.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
154 `recursive' - For include based searches, includes tables referenced
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
155 by included files.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
156 `omniscience' - Included system databases which are omniscience, or
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
157 somehow know everything. Omniscience databases are found
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
158 in `semanticdb-project-system-databases'.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
159 The Emacs Lisp system DB is an omniscience database."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
160 :group 'semanticdb
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
161 :type semanticdb-find-throttle-custom-list)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
162
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
163 (defun semanticdb-find-throttle-active-p (access-type)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
164 "Non-nil if ACCESS-TYPE is an active throttle type."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
165 (or (memq access-type semanticdb-find-default-throttle)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
166 (eq access-type 'file)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
167 (and (eq access-type 'local)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
168 (memq 'project semanticdb-find-default-throttle))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
169 ))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
170
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
171 ;;; Index Class
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
172 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
173 ;; The find routines spend a lot of time looking stuff up.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
174 ;; Use this handy search index to cache data between searches.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
175 ;; This should allow searches to start running faster.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
176 (defclass semanticdb-find-search-index (semanticdb-abstract-search-index)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
177 ((include-path :initform nil
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
178 :documentation
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
179 "List of semanticdb tables from the include path.")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
180 (type-cache :initform nil
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
181 :documentation
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
182 "Cache of all the data types accessible from this file.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
183 Includes all types from all included files, merged namespaces, and
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
184 expunge duplicates.")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
185 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
186 "Concrete search index for `semanticdb-find'.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
187 This class will cache data derived during various searches.")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
188
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
189 (defmethod semantic-reset ((idx semanticdb-find-search-index))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
190 "Reset the object IDX."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
191 ;; Clear the include path.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
192 (oset idx include-path nil)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
193 (when (oref idx type-cache)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
194 (semantic-reset (oref idx type-cache)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
195 ;; Clear the scope. Scope doesn't have the data it needs to track
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
196 ;; it's own reset.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
197 (semantic-scope-reset-cache)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
198 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
199
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
200 (defmethod semanticdb-synchronize ((idx semanticdb-find-search-index)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
201 new-tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
202 "Synchronize the search index IDX with some NEW-TAGS."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
203 ;; Reset our parts.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
204 (semantic-reset idx)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
205 ;; Notify dependants by clearning their indicies.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
206 (semanticdb-notify-references
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
207 (oref idx table)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
208 (lambda (tab me)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
209 (semantic-reset (semanticdb-get-table-index tab))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
210 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
211
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
212 (defmethod semanticdb-partial-synchronize ((idx semanticdb-find-search-index)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
213 new-tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
214 "Synchronize the search index IDX with some changed NEW-TAGS."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
215 ;; Only reset if include statements changed.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
216 (if (semantic-find-tags-by-class 'include new-tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
217 (progn
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
218 (semantic-reset idx)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
219 ;; Notify dependants by clearning their indicies.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
220 (semanticdb-notify-references
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
221 (oref idx table)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
222 (lambda (tab me)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
223 (semantic-reset (semanticdb-get-table-index tab))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
224 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
225 ;; Else, not an include, by just a type.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
226 (when (oref idx type-cache)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
227 (when (semanticdb-partial-synchronize (oref idx type-cache) new-tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
228 ;; If the synchronize returns true, we need to notify.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
229 ;; Notify dependants by clearning their indicies.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
230 (semanticdb-notify-references
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
231 (oref idx table)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
232 (lambda (tab me)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
233 (let ((tab-idx (semanticdb-get-table-index tab)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
234 ;; Not a full reset?
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
235 (when (oref tab-idx type-cache)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
236 (semanticdb-typecache-notify-reset
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
237 (oref tab-idx type-cache)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
238 )))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
239 ))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
240 ))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
241
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
242
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
243 ;;; Path Translations
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
244 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
245 ;;; OVERLOAD Functions
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
246 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
247 ;; These routines needed to be overloaded by specific language modes.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
248 ;; They are needed for translating an INCLUDE tag into a semanticdb
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
249 ;; TABLE object.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
250 (define-overloadable-function semanticdb-find-translate-path (path brutish)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
251 "Translate PATH into a list of semantic tables.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
252 Path translation involves identifying the PATH input argument
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
253 in one of the following ways:
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
254 nil - Take the current buffer, and use it's include list
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
255 buffer - Use that buffer's include list.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
256 filename - Use that file's include list. If the file is not
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
257 in a buffer, see of there is a semanticdb table for it. If
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
258 not, read that file into a buffer.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
259 tag - Get that tag's buffer of file file. See above.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
260 table - Search that table, and it's include list.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
261 find result - Search the results of a previous find.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
262
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
263 In addition, once the base path is found, there is the possibility of
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
264 each added table adding yet more tables to the path, so this routine
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
265 can return a lengthy list.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
266
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
267 If argument BRUTISH is non-nil, then instead of using the include
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
268 list, use all tables found in the parent project of the table
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
269 identified by translating PATH. Such searches use brute force to
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
270 scan every available table.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
271
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
272 The return value is a list of objects of type `semanticdb-table' or
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
273 it's children. In the case of passing in a find result, the result
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
274 is returned unchanged.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
275
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
276 This routine uses `semanticdb-find-table-for-include' to translate
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
277 specific include tags into a semanticdb table.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
278
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
279 Note: When searching using a non-brutish method, the list of
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
280 included files will be cached between runs. Database-references
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
281 are used to track which files need to have their include lists
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
282 refreshed when things change. See `semanticdb-ref-test'.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
283
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
284 Note for overloading: If you opt to overload this function for your
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
285 major mode, and your routine takes a long time, be sure to call
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
286
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
287 (semantic-throw-on-input 'your-symbol-here)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
288
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
289 so that it can be called from the idle work handler."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
290 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
291
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
292 (defun semanticdb-find-translate-path-default (path brutish)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
293 "Translate PATH into a list of semantic tables.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
294 If BRUTISH is non nil, return all tables associated with PATH.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
295 Default action as described in `semanticdb-find-translate-path'."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
296 (if (semanticdb-find-results-p path)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
297 ;; nil means perform the search over these results.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
298 nil
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
299 (if brutish
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
300 (semanticdb-find-translate-path-brutish-default path)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
301 (semanticdb-find-translate-path-includes-default path))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
302
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
303 (defun semanticdb-find-translate-path-brutish-default (path)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
304 "Translate PATH into a list of semantic tables.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
305 Default action as described in `semanticdb-find-translate-path'."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
306 (let ((basedb
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
307 (cond ((null path) semanticdb-current-database)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
308 ((semanticdb-table-p path) (oref path parent-db))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
309 (t (let ((tt (semantic-something-to-tag-table path)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
310 (save-excursion
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
311 ;; @todo - What does this DO ??!?!
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
312 (set-buffer (semantic-tag-buffer (car tt)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
313 semanticdb-current-database))))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
314 (apply
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
315 #'nconc
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
316 (mapcar
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
317 (lambda (db)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
318 (let ((tabs (semanticdb-get-database-tables db))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
319 (ret nil))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
320 ;; Only return tables of the same language (major-mode)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
321 ;; as the current search environment.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
322 (while tabs
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
323
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
324 (semantic-throw-on-input 'translate-path-brutish)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
325
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
326 (if (semanticdb-equivalent-mode-for-search (car tabs)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
327 (current-buffer))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
328 (setq ret (cons (car tabs) ret)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
329 (setq tabs (cdr tabs)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
330 ret))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
331 ;; FIXME:
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
332 ;; This should scan the current project directory list for all
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
333 ;; semanticdb files, perhaps handling proxies for them.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
334 (semanticdb-current-database-list
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
335 (if basedb (oref basedb reference-directory)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
336 default-directory))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
337 ))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
338
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
339 (defun semanticdb-find-incomplete-cache-entries-p (cache)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
340 "Are there any incomplete entries in CACHE?"
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
341 (let ((ans nil))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
342 (dolist (tab cache)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
343 (when (and (semanticdb-table-child-p tab)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
344 (not (number-or-marker-p (oref tab pointmax))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
345 (setq ans t))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
346 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
347 ans))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
348
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
349 (defun semanticdb-find-need-cache-update-p (table)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
350 "Non nil if the semanticdb TABLE cache needs to be updated."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
351 ;; If we were passed in something related to a TABLE,
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
352 ;; do a caching lookup.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
353 (let* ((index (semanticdb-get-table-index table))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
354 (cache (when index (oref index include-path)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
355 (incom (semanticdb-find-incomplete-cache-entries-p cache))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
356 (unl (semanticdb-find-throttle-active-p 'unloaded))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
357 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
358 (if (and
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
359 cache ;; Must have a cache
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
360 (or
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
361 ;; If all entries are "full", or if 'unloaded
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
362 ;; OR
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
363 ;; is not in the throttle, it is ok to use the cache.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
364 (not incom) (not unl)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
365 ))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
366 nil
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
367 ;;cache
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
368 ;; ELSE
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
369 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
370 ;; We need an update.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
371 t))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
372 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
373
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
374 (defun semanticdb-find-translate-path-includes-default (path)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
375 "Translate PATH into a list of semantic tables.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
376 Default action as described in `semanticdb-find-translate-path'."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
377 (let ((table (cond ((null path)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
378 semanticdb-current-table)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
379 ((bufferp path)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
380 (semantic-buffer-local-value 'semanticdb-current-table path))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
381 ((and (stringp path) (file-exists-p path))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
382 (semanticdb-file-table-object path t))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
383 ((semanticdb-abstract-table-child-p path)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
384 path)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
385 (t nil))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
386 (if table
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
387 ;; If we were passed in something related to a TABLE,
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
388 ;; do a caching lookup.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
389 (let ((index (semanticdb-get-table-index table)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
390 (if (semanticdb-find-need-cache-update-p table)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
391 ;; Lets go look up our indicies
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
392 (let ((ans (semanticdb-find-translate-path-includes--internal path)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
393 (oset index include-path ans)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
394 ;; Once we have our new indicies set up, notify those
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
395 ;; who depend on us if we found something for them to
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
396 ;; depend on.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
397 (when ans (semanticdb-refresh-references table))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
398 ans)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
399 ;; ELSE
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
400 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
401 ;; Just return the cache.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
402 (oref index include-path)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
403 ;; If we were passed in something like a tag list, or other boring
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
404 ;; searchable item, then instead do the regular thing without caching.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
405 (semanticdb-find-translate-path-includes--internal path))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
406
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
407 (defvar semanticdb-find-lost-includes nil
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
408 "Include files that we cannot find associated with this buffer.")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
409 (make-variable-buffer-local 'semanticdb-find-lost-includes)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
410
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
411 (defvar semanticdb-find-scanned-include-tags nil
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
412 "All include tags scanned, plus action taken on the tag.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
413 Each entry is an alist:
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
414 (ACTION . TAG)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
415 where ACTION is one of 'scanned, 'duplicate, 'lost.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
416 and TAG is a clone of the include tag that was found.")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
417 (make-variable-buffer-local 'semanticdb-find-scanned-include-tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
418
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
419 (defvar semanticdb-implied-include-tags nil
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
420 "Include tags implied for all files of a given mode.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
421 Set this variable with `defvar-mode-local' for a particular mode so
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
422 that any symbols that exist for all files for that mode are included.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
423
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
424 Note: This could be used as a way to write a file in a langauge
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
425 to declare all the built-ins for that language.")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
426
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
427 (defun semanticdb-find-translate-path-includes--internal (path)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
428 "Internal implementation of `semanticdb-find-translate-path-includes-default'.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
429 This routine does not depend on the cache, but will always derive
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
430 a new path from the provided PATH."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
431 (let ((includetags nil)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
432 (curtable nil)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
433 (matchedtables (list semanticdb-current-table))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
434 (matchedincludes nil)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
435 (lostincludes nil)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
436 (scannedincludes nil)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
437 (incfname nil)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
438 nexttable)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
439 (cond ((null path)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
440 (semantic-refresh-tags-safe)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
441 (setq includetags (append
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
442 (semantic-find-tags-included (current-buffer))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
443 semanticdb-implied-include-tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
444 curtable semanticdb-current-table
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
445 incfname (buffer-file-name))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
446 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
447 ((semanticdb-table-p path)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
448 (setq includetags (semantic-find-tags-included path)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
449 curtable path
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
450 incfname (semanticdb-full-filename path))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
451 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
452 ((bufferp path)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
453 (save-excursion
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
454 (set-buffer path)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
455 (semantic-refresh-tags-safe))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
456 (setq includetags (semantic-find-tags-included path)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
457 curtable (save-excursion (set-buffer path)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
458 semanticdb-current-table)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
459 incfname (buffer-file-name path)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
460 (t
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
461 (setq includetags (semantic-find-tags-included path))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
462 (when includetags
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
463 ;; If we have some tags, derive a table from them.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
464 ;; else we will do nothing, so the table is useless.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
465
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
466 ;; @todo - derive some tables
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
467 (message "Need to derive tables for %S in translate-path-includes--default."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
468 path)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
469 )))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
470
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
471 ;; Make sure each found include tag has an originating file name associated
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
472 ;; with it.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
473 (when incfname
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
474 (dolist (it includetags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
475 (semantic--tag-put-property it :filename incfname)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
476
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
477 ;; Loop over all include tags adding to matchedtables
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
478 (while includetags
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
479 (semantic-throw-on-input 'semantic-find-translate-path-includes-default)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
480
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
481 ;; If we've seen this include string before, lets skip it.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
482 (if (member (semantic-tag-name (car includetags)) matchedincludes)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
483 (progn
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
484 (setq nexttable nil)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
485 (push (cons 'duplicate (semantic-tag-clone (car includetags)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
486 scannedincludes)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
487 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
488 (setq nexttable (semanticdb-find-table-for-include (car includetags) curtable))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
489 (when (not nexttable)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
490 ;; Save the lost include.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
491 (push (car includetags) lostincludes)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
492 (push (cons 'lost (semantic-tag-clone (car includetags)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
493 scannedincludes)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
494 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
495 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
496
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
497 ;; Push the include file, so if we can't find it, we only
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
498 ;; can't find it once.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
499 (push (semantic-tag-name (car includetags)) matchedincludes)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
500
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
501 ;; (message "Scanning %s" (semantic-tag-name (car includetags)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
502 (when (and nexttable
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
503 (not (memq nexttable matchedtables))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
504 (semanticdb-equivalent-mode-for-search nexttable
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
505 (current-buffer))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
506 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
507 ;; Add to list of tables
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
508 (push nexttable matchedtables)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
509
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
510 ;; Queue new includes to list
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
511 (if (semanticdb-find-throttle-active-p 'recursive)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
512 ;; @todo - recursive includes need to have the originating
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
513 ;; buffer's location added to the path.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
514 (let ((newtags
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
515 (cond
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
516 ((semanticdb-table-p nexttable)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
517 (semanticdb-refresh-table nexttable)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
518 ;; Use the method directly, or we will recurse
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
519 ;; into ourselves here.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
520 (semanticdb-find-tags-by-class-method
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
521 nexttable 'include))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
522 (t ;; @todo - is this ever possible???
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
523 (message "semanticdb-ftp - how did you do that?")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
524 (semantic-find-tags-included
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
525 (semanticdb-get-tags nexttable)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
526 ))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
527 (newincfname (semanticdb-full-filename nexttable))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
528 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
529
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
530 (push (cons 'scanned (semantic-tag-clone (car includetags)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
531 scannedincludes)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
532
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
533 ;; Setup new tags so we know where they are.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
534 (dolist (it newtags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
535 (semantic--tag-put-property it :filename
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
536 newincfname))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
537
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
538 (setq includetags (nconc includetags newtags)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
539 ;; ELSE - not recursive throttle
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
540 (push (cons 'scanned-no-recurse
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
541 (semantic-tag-clone (car includetags)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
542 scannedincludes)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
543 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
544 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
545 (setq includetags (cdr includetags)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
546
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
547 (setq semanticdb-find-lost-includes lostincludes)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
548 (setq semanticdb-find-scanned-include-tags (reverse scannedincludes))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
549
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
550 ;; Find all the omniscient databases for this major mode, and
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
551 ;; add them if needed
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
552 (when (and (semanticdb-find-throttle-active-p 'omniscience)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
553 semanticdb-search-system-databases)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
554 ;; We can append any mode-specific omniscience databases into
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
555 ;; our search list here.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
556 (let ((systemdb semanticdb-project-system-databases)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
557 (ans nil))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
558 (while systemdb
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
559 (setq ans (semanticdb-file-table
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
560 (car systemdb)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
561 ;; I would expect most omniscient to return the same
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
562 ;; thing reguardless of filename, but we may have
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
563 ;; one that can return a table of all things the
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
564 ;; current file needs.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
565 (buffer-file-name (current-buffer))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
566 (when (not (memq ans matchedtables))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
567 (setq matchedtables (cons ans matchedtables)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
568 (setq systemdb (cdr systemdb))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
569 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
570 (nreverse matchedtables)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
571
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
572 (define-overloadable-function semanticdb-find-load-unloaded (filename)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
573 "Create a database table for FILENAME if it hasn't been parsed yet.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
574 Assumes that FILENAME exists as a source file.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
575 Assumes that a preexisting table does not exist, even if it
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
576 isn't in memory yet."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
577 (if (semanticdb-find-throttle-active-p 'unloaded)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
578 (:override)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
579 (semanticdb-file-table-object filename t)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
580
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
581 (defun semanticdb-find-load-unloaded-default (filename)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
582 "Load an unloaded file in FILENAME using the default semanticdb loader."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
583 (semanticdb-file-table-object filename))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
584
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
585 (define-overloadable-function semanticdb-find-table-for-include (includetag &optional table)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
586 "For a single INCLUDETAG found in TABLE, find a `semanticdb-table' object
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
587 INCLUDETAG is a semantic TAG of class 'include.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
588 TABLE is a semanticdb table that identifies where INCLUDETAG came from.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
589 TABLE is optional if INCLUDETAG has an overlay of :filename attribute."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
590 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
591
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
592 (defun semanticdb-find-table-for-include-default (includetag &optional table)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
593 "Default implementation of `semanticdb-find-table-for-include'.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
594 Uses `semanticdb-current-database-list' as the search path.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
595 INCLUDETAG and TABLE are documented in `semanticdb-find-table-for-include'.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
596 Included databases are filtered based on `semanticdb-find-default-throttle'."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
597 (if (not (eq (semantic-tag-class includetag) 'include))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
598 (signal 'wrong-type-argument (list includetag 'include)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
599
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
600 (let ((name
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
601 ;; Note, some languages (like Emacs or Java) use include tag names
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
602 ;; that don't represent files! We want to have file names.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
603 (semantic-tag-include-filename includetag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
604 (originfiledir nil)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
605 (roots nil)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
606 (tmp nil)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
607 (ans nil))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
608
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
609 ;; INCLUDETAG should have some way to reference where it came
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
610 ;; from! If not, TABLE should provide the way. Each time we
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
611 ;; look up a tag, we may need to find it in some relative way
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
612 ;; and must set our current buffer eto the origin of includetag
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
613 ;; or nothing may work.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
614 (setq originfiledir
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
615 (cond ((semantic-tag-file-name includetag)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
616 ;; A tag may have a buffer, or a :filename property.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
617 (file-name-directory (semantic-tag-file-name includetag)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
618 (table
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
619 (file-name-directory (semanticdb-full-filename table)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
620 (t
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
621 ;; @todo - what to do here? Throw an error maybe
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
622 ;; and fix usage bugs?
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
623 default-directory)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
624
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
625 (cond
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
626 ;; Step 1: Relative path name
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
627 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
628 ;; If the name is relative, then it should be findable as relative
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
629 ;; to the source file that this tag originated in, and be fast.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
630 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
631 ((and (semanticdb-find-throttle-active-p 'local)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
632 (file-exists-p (expand-file-name name originfiledir)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
633
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
634 (setq ans (semanticdb-find-load-unloaded
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
635 (expand-file-name name originfiledir)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
636 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
637 ;; Step 2: System or Project level includes
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
638 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
639 ((or
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
640 ;; First, if it a system include, we can investigate that tags
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
641 ;; dependency file
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
642 (and (semanticdb-find-throttle-active-p 'system)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
643
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
644 ;; Sadly, not all languages make this distinction.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
645 ;;(semantic-tag-include-system-p includetag)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
646
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
647 ;; Here, we get local and system files.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
648 (setq tmp (semantic-dependency-tag-file includetag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
649 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
650 ;; Second, project files are active, we and we have EDE,
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
651 ;; we can find it using the same tool.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
652 (and (semanticdb-find-throttle-active-p 'project)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
653 ;; Make sure EDE is available, and we have a project
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
654 (featurep 'ede) (ede-current-project originfiledir)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
655 ;; The EDE query is hidden in this call.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
656 (setq tmp (semantic-dependency-tag-file includetag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
657 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
658 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
659 (setq ans (semanticdb-find-load-unloaded tmp))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
660 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
661 ;; Somewhere in our project hierarchy
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
662 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
663 ;; Remember: Roots includes system databases which can create
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
664 ;; specialized tables we can search.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
665 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
666 ;; NOTE: Not used if EDE is active!
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
667 ((and (semanticdb-find-throttle-active-p 'project)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
668 ;; And dont do this if it is a system include. Not supported by all languages,
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
669 ;; but when it is, this is a nice fast way to skip this step.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
670 (not (semantic-tag-include-system-p includetag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
671 ;; Don't do this if we have an EDE project.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
672 (not (and (featurep 'ede)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
673 ;; Note: We don't use originfiledir here because
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
674 ;; we want to know about the source file we are
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
675 ;; starting from.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
676 (ede-current-project)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
677 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
678
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
679 (setq roots (semanticdb-current-database-list))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
680
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
681 (while (and (not ans) roots)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
682 (let* ((ref (if (slot-boundp (car roots) 'reference-directory)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
683 (oref (car roots) reference-directory)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
684 (fname (cond ((null ref) nil)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
685 ((file-exists-p (expand-file-name name ref))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
686 (expand-file-name name ref))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
687 ((file-exists-p (expand-file-name (file-name-nondirectory name) ref))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
688 (expand-file-name (file-name-nondirectory name) ref)))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
689 (when (and ref fname)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
690 ;; There is an actual file. Grab it.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
691 (setq ans (semanticdb-find-load-unloaded fname)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
692
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
693 ;; ELSE
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
694 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
695 ;; NOTE: We used to look up omniscient databases here, but that
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
696 ;; is now handled one layer up.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
697 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
698 ;; Missing: a database that knows where missing files are. Hmm.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
699 ;; perhaps I need an override function for that?
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
700
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
701 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
702
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
703 (setq roots (cdr roots))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
704 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
705 ans))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
706
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
707
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
708 ;;; Perform interactive tests on the path/search mechanisms.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
709 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
710 (defun semanticdb-find-test-translate-path (&optional arg)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
711 "Call and output results of `semanticdb-find-translate-path'.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
712 With ARG non-nil, specify a BRUTISH translation.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
713 See `semanticdb-find-default-throttle' and `semanticdb-project-roots'
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
714 for details on how this list is derived."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
715 (interactive "P")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
716 (semantic-fetch-tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
717 (require 'data-debug)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
718 (let ((start (current-time))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
719 (p (semanticdb-find-translate-path nil arg))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
720 (end (current-time))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
721 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
722 (data-debug-new-buffer "*SEMANTICDB FTP ADEBUG*")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
723 (message "Search of tags took %.2f seconds."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
724 (semantic-elapsed-time start end))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
725
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
726 (data-debug-insert-stuff-list p "*")))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
727
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
728 (defun semanticdb-find-test-translate-path-no-loading (&optional arg)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
729 "Call and output results of `semanticdb-find-translate-path'.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
730 With ARG non-nil, specify a BRUTISH translation.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
731 See `semanticdb-find-default-throttle' and `semanticdb-project-roots'
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
732 for details on how this list is derived."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
733 (interactive "P")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
734 (semantic-fetch-tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
735 (require 'data-debug)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
736 (let* ((semanticdb-find-default-throttle
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
737 (if (featurep 'semanticdb-find)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
738 (remq 'unloaded semanticdb-find-default-throttle)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
739 nil))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
740 (start (current-time))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
741 (p (semanticdb-find-translate-path nil arg))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
742 (end (current-time))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
743 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
744 (data-debug-new-buffer "*SEMANTICDB FTP ADEBUG*")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
745 (message "Search of tags took %.2f seconds."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
746 (semantic-elapsed-time start end))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
747
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
748 (data-debug-insert-stuff-list p "*")))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
749
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
750 (defun semanticdb-find-adebug-lost-includes ()
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
751 "Translate the current path, then display the lost includes.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
752 Examines the variable `semanticdb-find-lost-includes'."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
753 (interactive)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
754 (require 'data-debug)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
755 (semanticdb-find-translate-path nil nil)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
756 (let ((lost semanticdb-find-lost-includes)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
757 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
758
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
759 (if (not lost)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
760 (message "There are no unknown includes for %s"
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
761 (buffer-name))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
762
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
763 (data-debug-new-buffer "*SEMANTICDB lost-includes ADEBUG*")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
764 (data-debug-insert-tag-list lost "*")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
765 )))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
766
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
767 (defun semanticdb-find-adebug-insert-scanned-tag-cons (consdata prefix prebuttontext)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
768 "Insert a button representing scanned include CONSDATA.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
769 PREFIX is the text that preceeds the button.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
770 PREBUTTONTEXT is some text between prefix and the overlay button."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
771 (let* ((start (point))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
772 (end nil)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
773 (mode (car consdata))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
774 (tag (cdr consdata))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
775 (name (semantic-tag-name tag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
776 (file (semantic-tag-file-name tag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
777 (str1 (format "%S %s" mode name))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
778 (str2 (format " : %s" file))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
779 (tip nil))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
780 (insert prefix prebuttontext str1)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
781 (setq end (point))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
782 (insert str2)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
783 (put-text-property start end 'face
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
784 (cond ((eq mode 'scanned)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
785 'font-lock-function-name-face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
786 ((eq mode 'duplicate)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
787 'font-lock-comment-face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
788 ((eq mode 'lost)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
789 'font-lock-variable-name-face)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
790 ((eq mode 'scanned-no-recurse)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
791 'font-lock-type-face)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
792 (put-text-property start end 'ddebug (cdr consdata))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
793 (put-text-property start end 'ddebug-indent(length prefix))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
794 (put-text-property start end 'ddebug-prefix prefix)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
795 (put-text-property start end 'help-echo tip)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
796 (put-text-property start end 'ddebug-function
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
797 'data-debug-insert-tag-parts-from-point)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
798 (insert "\n")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
799 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
800 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
801
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
802 (defun semanticdb-find-adebug-scanned-includes ()
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
803 "Translate the current path, then display the lost includes.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
804 Examines the variable `semanticdb-find-lost-includes'."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
805 (interactive)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
806 (require 'data-debug)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
807 (semanticdb-find-translate-path nil nil)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
808 (let ((scanned semanticdb-find-scanned-include-tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
809 (data-debug-thing-alist
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
810 (cons
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
811 '((lambda (thing) (and (consp thing)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
812 (symbolp (car thing))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
813 (memq (car thing)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
814 '(scanned scanned-no-recurse
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
815 lost duplicate))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
816 . semanticdb-find-adebug-insert-scanned-tag-cons)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
817 data-debug-thing-alist))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
818 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
819
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
820 (if (not scanned)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
821 (message "There are no includes scanned %s"
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
822 (buffer-name))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
823
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
824 (data-debug-new-buffer "*SEMANTICDB scanned-includes ADEBUG*")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
825 (data-debug-insert-stuff-list scanned "*")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
826 )))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
827
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
828 ;;; FIND results and edebug
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
829 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
830 (eval-after-load "cedet-edebug"
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
831 '(progn
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
832 (cedet-edebug-add-print-override
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
833 '(semanticdb-find-results-p object)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
834 '(semanticdb-find-result-prin1-to-string object) )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
835 ))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
836
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
837
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
838
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
839 ;;; API Functions
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
840 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
841 ;; Once you have a search result, use these routines to operate
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
842 ;; on the search results at a higher level
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
843
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
844 (defun semanticdb-strip-find-results (results &optional find-file-match)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
845 "Strip a semanticdb search RESULTS to exclude objects.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
846 This makes it appear more like the results of a `semantic-find-' call.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
847 Optional FIND-FILE-MATCH loads all files associated with RESULTS
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
848 into buffers. This has the side effect of enabling `semantic-tag-buffer' to
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
849 return a value.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
850 If FIND-FILE-MATCH is 'name, then only the filename is stored
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
851 in each tag instead of loading each file into a buffer.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
852 If the input RESULTS are not going to be used again, and if
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
853 FIND-FILE-MATCH is nil, you can use `semanticdb-fast-strip-find-results'
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
854 instead."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
855 (if find-file-match
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
856 ;; Load all files associated with RESULTS.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
857 (let ((tmp results)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
858 (output nil))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
859 (while tmp
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
860 (let ((tab (car (car tmp)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
861 (tags (cdr (car tmp))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
862 (dolist (T tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
863 ;; Normilzation gives specialty database tables a chance
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
864 ;; to convert into a more stable tag format.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
865 (let* ((norm (semanticdb-normalize-one-tag tab T))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
866 (ntab (car norm))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
867 (ntag (cdr norm))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
868 (nametable ntab))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
869
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
870 ;; If it didn't normalize, use what we had.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
871 (if (not norm)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
872 (setq nametable tab)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
873 (setq output (append output (list ntag))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
874
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
875 ;; Find-file-match allows a tool to make sure the tag is
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
876 ;; 'live', somewhere in a buffer.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
877 (cond ((eq find-file-match 'name)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
878 (let ((f (semanticdb-full-filename nametable)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
879 (semantic--tag-put-property ntag :filename f)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
880 ((and find-file-match ntab)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
881 (semanticdb-get-buffer ntab))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
882 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
883 ))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
884 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
885 (setq tmp (cdr tmp)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
886 output)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
887 ;; @todo - I could use nconc, but I don't know what the caller may do with
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
888 ;; RESULTS after this is called. Right now semantic-complete will
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
889 ;; recycling the input after calling this routine.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
890 (apply #'append (mapcar #'cdr results))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
891
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
892 (defun semanticdb-fast-strip-find-results (results)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
893 "Destructively strip a semanticdb search RESULTS to exclude objects.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
894 This makes it appear more like the results of a `semantic-find-' call.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
895 This is like `semanticdb-strip-find-results', except the input list RESULTS
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
896 will be changed."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
897 (apply #'nconc (mapcar #'cdr results)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
898
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
899 (defun semanticdb-find-results-p (resultp)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
900 "Non-nil if RESULTP is in the form of a semanticdb search result.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
901 This query only really tests the first entry in the list that is RESULTP,
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
902 but should be good enough for debugging assertions."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
903 (and (listp resultp)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
904 (listp (car resultp))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
905 (semanticdb-abstract-table-child-p (car (car resultp)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
906 (or (semantic-tag-p (car (cdr (car resultp))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
907 (null (car (cdr (car resultp)))))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
908
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
909 (defun semanticdb-find-result-prin1-to-string (result)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
910 "Presuming RESULT satisfies `semanticdb-find-results-p', provide a short PRIN1 output."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
911 (if (< (length result) 2)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
912 (concat "#<FIND RESULT "
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
913 (mapconcat (lambda (a)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
914 (concat "(" (object-name (car a) ) " . "
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
915 "#<TAG LIST " (number-to-string (length (cdr a))) ">)"))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
916 result
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
917 " ")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
918 ">")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
919 ;; Longer results should have an abreviated form.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
920 (format "#<FIND RESULT %d TAGS in %d FILES>"
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
921 (semanticdb-find-result-length result)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
922 (length result))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
923
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
924 (defun semanticdb-find-result-with-nil-p (resultp)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
925 "Non-nil of RESULTP is in the form of a semanticdb search result.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
926 nil is a valid value where a TABLE usually is, but only if the TAG
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
927 results include overlays.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
928 This query only really tests the first entry in the list that is RESULTP,
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
929 but should be good enough for debugging assertions."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
930 (and (listp resultp)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
931 (listp (car resultp))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
932 (let ((tag-to-test (car-safe (cdr (car resultp)))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
933 (or (and (semanticdb-abstract-table-child-p (car (car resultp)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
934 (or (semantic-tag-p tag-to-test)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
935 (null tag-to-test)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
936 (and (null (car (car resultp)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
937 (or (semantic-tag-with-position-p tag-to-test)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
938 (null tag-to-test))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
939 )))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
940
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
941 (defun semanticdb-find-result-length (result)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
942 "Number of tags found in RESULT."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
943 (let ((count 0))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
944 (mapc (lambda (onetable)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
945 (setq count (+ count (1- (length onetable)))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
946 result)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
947 count))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
948
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
949 (defun semanticdb-find-result-nth (result n)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
950 "In RESULT, return the Nth search result.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
951 This is a 0 based search result, with the first match being element 0.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
952
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
953 The returned value is a cons cell: (TAG . TABLE) where TAG
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
954 is the tag at the Nth position. TABLE is the semanticdb table where
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
955 the TAG was found. Sometimes TABLE can be nil."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
956 (let ((ans nil)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
957 (anstable nil))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
958 ;; Loop over each single table hit.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
959 (while (and (not ans) result)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
960 ;; For each table result, get local length, and modify
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
961 ;; N to be that much less.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
962 (let ((ll (length (cdr (car result))))) ;; local length
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
963 (if (> ll n)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
964 ;; We have a local match.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
965 (setq ans (nth n (cdr (car result)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
966 anstable (car (car result)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
967 ;; More to go. Decrement N.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
968 (setq n (- n ll))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
969 ;; Keep moving.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
970 (setq result (cdr result)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
971 (cons ans anstable)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
972
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
973 (defun semanticdb-find-result-test (result)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
974 "Test RESULT by accessing all the tags in the list."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
975 (if (not (semanticdb-find-results-p result))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
976 (error "Does not pass `semanticdb-find-results-p.\n"))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
977 (let ((len (semanticdb-find-result-length result))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
978 (i 0))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
979 (while (< i len)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
980 (let ((tag (semanticdb-find-result-nth result i)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
981 (if (not (semantic-tag-p (car tag)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
982 (error "%d entry is not a tag" i)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
983 (setq i (1+ i)))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
984
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
985 (defun semanticdb-find-result-nth-in-buffer (result n)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
986 "In RESULT, return the Nth search result.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
987 Like `semanticdb-find-result-nth', except that only the TAG
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
988 is returned, and the buffer it is found it will be made current.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
989 If the result tag has no position information, the originating buffer
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
990 is still made current."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
991 (let* ((ret (semanticdb-find-result-nth result n))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
992 (ans (car ret))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
993 (anstable (cdr ret)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
994 ;; If we have a hit, double-check the find-file
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
995 ;; entry. If the file must be loaded, then gat that table's
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
996 ;; source file into a buffer.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
997
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
998 (if anstable
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
999 (let ((norm (semanticdb-normalize-one-tag anstable ans)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1000 (when norm
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1001 ;; The normalized tags can now be found based on that
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1002 ;; tags table.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1003 (semanticdb-set-buffer (car norm))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1004 ;; Now reset ans
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1005 (setq ans (cdr norm))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1006 ))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1007 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1008 ;; Return the tag.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1009 ans))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1010
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1011 (defun semanticdb-find-result-mapc (fcn result)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1012 "Apply FCN to each element of find RESULT for side-effects only.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1013 FCN takes two arguments. The first is a TAG, and the
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1014 second is a DB from wence TAG originated.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1015 Returns result."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1016 (mapc (lambda (sublst)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1017 (mapc (lambda (tag)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1018 (funcall fcn tag (car sublst)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1019 (cdr sublst)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1020 result)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1021 result)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1022
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1023 ;;; Search Logging
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1024 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1025 ;; Basic logging to see what the search routines are doing.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1026 (defvar semanticdb-find-log-flag nil
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1027 "Non-nil means log the process of searches.")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1028
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1029 (defvar semanticdb-find-log-buffer-name "*SemanticDB Find Log*"
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1030 "The name of the logging buffer.")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1031
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1032 (defun semanticdb-find-toggle-logging ()
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1033 "Toggle sematnicdb logging."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1034 (interactive)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1035 (setq semanticdb-find-log-flag (null semanticdb-find-log-flag))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1036 (message "Semanticdb find logging is %sabled"
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1037 (if semanticdb-find-log-flag "en" "dis")))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1038
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1039 (defun semanticdb-reset-log ()
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1040 "Reset the log buffer."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1041 (interactive)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1042 (when semanticdb-find-log-flag
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1043 (save-excursion
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1044 (set-buffer (get-buffer-create semanticdb-find-log-buffer-name))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1045 (erase-buffer)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1046 )))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1047
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1048 (defun semanticdb-find-log-move-to-end ()
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1049 "Move to the end of the semantic log."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1050 (let ((cb (current-buffer))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1051 (cw (selected-window)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1052 (unwind-protect
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1053 (progn
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1054 (set-buffer semanticdb-find-log-buffer-name)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1055 (if (get-buffer-window (current-buffer) 'visible)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1056 (select-window (get-buffer-window (current-buffer) 'visible)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1057 (goto-char (point-max)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1058 (if cw (select-window cw))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1059 (set-buffer cb))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1060
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1061 (defun semanticdb-find-log-new-search (forwhat)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1062 "Start a new search FORWHAT."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1063 (when semanticdb-find-log-flag
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1064 (save-excursion
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1065 (set-buffer (get-buffer-create semanticdb-find-log-buffer-name))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1066 (insert (format "New Search: %S\n" forwhat))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1067 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1068 (semanticdb-find-log-move-to-end)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1069
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1070 (defun semanticdb-find-log-activity (table result)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1071 "Log that TABLE has been searched and RESULT was found."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1072 (when semanticdb-find-log-flag
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1073 (save-excursion
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1074 (set-buffer semanticdb-find-log-buffer-name)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1075 (insert "Table: " (object-print table)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1076 " Result: " (int-to-string (length result)) " tags"
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1077 "\n")
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1078 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1079 (semanticdb-find-log-move-to-end)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1080
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1081 ;;; Semanticdb find API functions
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1082 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1083 ;; These are the routines actually used to perform searches.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1084 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1085 (defun semanticdb-find-tags-collector (function &optional path find-file-match
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1086 brutish)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1087 "Collect all tags returned by FUNCTION over PATH.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1088 The FUNCTION must take two arguments. The first is TABLE,
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1089 which is a semanticdb table containing tags. The second argument
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1090 to FUNCTION is TAGS. TAGS may be a list of tags. If TAGS is non-nil, then
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1091 FUNCTION should search the TAG list, not through TABLE.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1092
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1093 See `semanticdb-find-translate-path' for details on PATH.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1094 FIND-FILE-MATCH indicates that any time a match is found, the file
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1095 associated with that tag should be loaded into a buffer.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1096
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1097 Note: You should leave FIND-FILE-MATCH as nil. It is far more
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1098 efficient to take the results from any search and use
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1099 `semanticdb-strip-find-results' instead. This argument is here
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1100 for backward compatibility.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1101
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1102 If optional argument BRUTISH is non-nil, then ignore include statements,
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1103 and search all tables in this project tree."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1104 (let (found match)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1105 (save-excursion
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1106 ;; If path is a buffer, set ourselves up in that buffer
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1107 ;; so that the override methods work correctly.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1108 (when (bufferp path) (set-buffer path))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1109 (if (semanticdb-find-results-p path)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1110 ;; When we get find results, loop over that.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1111 (dolist (tableandtags path)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1112 (semantic-throw-on-input 'semantic-find-translate-path)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1113 ;; If FIND-FILE-MATCH is non-nil, skip tables of class
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1114 ;; `semanticdb-search-results-table', since those are system
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1115 ;; databases and not associated with a file.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1116 (unless (and find-file-match
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1117 (obj-of-class-p
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1118 (car tableandtags) semanticdb-search-results-table))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1119 (when (setq match (funcall function
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1120 (car tableandtags) (cdr tableandtags)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1121 (when find-file-match
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1122 (save-excursion (semanticdb-set-buffer (car tableandtags))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1123 (push (cons (car tableandtags) match) found)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1124 )
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1125 ;; Only log searches across data bases.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1126 (semanticdb-find-log-new-search nil)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1127 ;; If we get something else, scan the list of tables resulting
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1128 ;; from translating it into a list of objects.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1129 (dolist (table (semanticdb-find-translate-path path brutish))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1130 (semantic-throw-on-input 'semantic-find-translate-path)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1131 ;; If FIND-FILE-MATCH is non-nil, skip tables of class
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1132 ;; `semanticdb-search-results-table', since those are system
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1133 ;; databases and not associated with a file.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1134 (unless (and find-file-match
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1135 (obj-of-class-p table semanticdb-search-results-table))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1136 (when (and table (setq match (funcall function table nil)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1137 (semanticdb-find-log-activity table match)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1138 (when find-file-match
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1139 (save-excursion (semanticdb-set-buffer table)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1140 (push (cons table match) found))))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1141 ;; At this point, FOUND has had items pushed onto it.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1142 ;; This means items are being returned in REVERSE order
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1143 ;; of the tables searched, so if you just get th CAR, then
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1144 ;; too-bad, you may have some system-tag that has no
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1145 ;; buffer associated with it.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1146
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1147 ;; It must be reversed.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1148 (nreverse found)))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1149
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1150 (defun semanticdb-find-tags-by-name (name &optional path find-file-match)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1151 "Search for all tags matching NAME on PATH.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1152 See `semanticdb-find-translate-path' for details on PATH.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1153 FIND-FILE-MATCH indicates that any time a match is found, the file
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1154 associated with that tag should be loaded into a buffer."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1155 (semanticdb-find-tags-collector
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1156 (lambda (table tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1157 (semanticdb-find-tags-by-name-method table name tags))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1158 path find-file-match))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1159
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1160 (defun semanticdb-find-tags-by-name-regexp (regexp &optional path find-file-match)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1161 "Search for all tags matching REGEXP on PATH.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1162 See `semanticdb-find-translate-path' for details on PATH.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1163 FIND-FILE-MATCH indicates that any time a match is found, the file
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1164 associated with that tag should be loaded into a buffer."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1165 (semanticdb-find-tags-collector
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1166 (lambda (table tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1167 (semanticdb-find-tags-by-name-regexp-method table regexp tags))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1168 path find-file-match))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1169
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1170 (defun semanticdb-find-tags-for-completion (prefix &optional path find-file-match)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1171 "Search for all tags matching PREFIX on PATH.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1172 See `semanticdb-find-translate-path' for details on PATH.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1173 FIND-FILE-MATCH indicates that any time a match is found, the file
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1174 associated with that tag should be loaded into a buffer."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1175 (semanticdb-find-tags-collector
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1176 (lambda (table tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1177 (semanticdb-find-tags-for-completion-method table prefix tags))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1178 path find-file-match))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1179
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1180 (defun semanticdb-find-tags-by-class (class &optional path find-file-match)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1181 "Search for all tags of CLASS on PATH.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1182 See `semanticdb-find-translate-path' for details on PATH.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1183 FIND-FILE-MATCH indicates that any time a match is found, the file
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1184 associated with that tag should be loaded into a buffer."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1185 (semanticdb-find-tags-collector
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1186 (lambda (table tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1187 (semanticdb-find-tags-by-class-method table class tags))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1188 path find-file-match))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1189
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1190 ;;; Deep Searches
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1191 (defun semanticdb-deep-find-tags-by-name (name &optional path find-file-match)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1192 "Search for all tags matching NAME on PATH.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1193 Search also in all components of top level tags founds.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1194 See `semanticdb-find-translate-path' for details on PATH.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1195 FIND-FILE-MATCH indicates that any time a match is found, the file
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1196 associated with that tag should be loaded into a buffer."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1197 (semanticdb-find-tags-collector
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1198 (lambda (table tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1199 (semanticdb-deep-find-tags-by-name-method table name tags))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1200 path find-file-match))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1201
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1202 (defun semanticdb-deep-find-tags-by-name-regexp (regexp &optional path find-file-match)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1203 "Search for all tags matching REGEXP on PATH.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1204 Search also in all components of top level tags founds.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1205 See `semanticdb-find-translate-path' for details on PATH.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1206 FIND-FILE-MATCH indicates that any time a match is found, the file
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1207 associated with that tag should be loaded into a buffer."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1208 (semanticdb-find-tags-collector
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1209 (lambda (table tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1210 (semanticdb-deep-find-tags-by-name-regexp-method table regexp tags))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1211 path find-file-match))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1212
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1213 (defun semanticdb-deep-find-tags-for-completion (prefix &optional path find-file-match)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1214 "Search for all tags matching PREFIX on PATH.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1215 Search also in all components of top level tags founds.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1216 See `semanticdb-find-translate-path' for details on PATH.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1217 FIND-FILE-MATCH indicates that any time a match is found, the file
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1218 associated with that tag should be loaded into a buffer."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1219 (semanticdb-find-tags-collector
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1220 (lambda (table tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1221 (semanticdb-deep-find-tags-for-completion-method table prefix tags))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1222 path find-file-match))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1223
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1224 ;;; Brutish Search Routines
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1225 (defun semanticdb-brute-deep-find-tags-by-name (name &optional path find-file-match)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1226 "Search for all tags matching NAME on PATH.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1227 See `semanticdb-find-translate-path' for details on PATH.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1228 The argument BRUTISH will be set so that searching includes all tables
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1229 in the current project.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1230 FIND-FILE-MATCH indicates that any time a matchi is found, the file
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1231 associated wit that tag should be loaded into a buffer."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1232 (semanticdb-find-tags-collector
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1233 (lambda (table tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1234 (semanticdb-deep-find-tags-by-name-method table name tags))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1235 path find-file-match t))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1236
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1237 (defun semanticdb-brute-deep-find-tags-for-completion (prefix &optional path find-file-match)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1238 "Search for all tags matching PREFIX on PATH.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1239 See `semanticdb-find-translate-path' for details on PATH.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1240 The argument BRUTISH will be set so that searching includes all tables
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1241 in the current project.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1242 FIND-FILE-MATCH indicates that any time a matchi is found, the file
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1243 associated wit that tag should be loaded into a buffer."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1244 (semanticdb-find-tags-collector
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1245 (lambda (table tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1246 (semanticdb-deep-find-tags-for-completion-method table prefix tags))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1247 path find-file-match t))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1248
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1249 (defun semanticdb-brute-find-tags-by-class (class &optional path find-file-match)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1250 "Search for all tags of CLASS on PATH.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1251 See `semanticdb-find-translate-path' for details on PATH.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1252 The argument BRUTISH will be set so that searching includes all tables
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1253 in the current project.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1254 FIND-FILE-MATCH indicates that any time a match is found, the file
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1255 associated with that tag should be loaded into a buffer."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1256 (semanticdb-find-tags-collector
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1257 (lambda (table tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1258 (semanticdb-find-tags-by-class-method table class tags))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1259 path find-file-match t))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1260
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1261 ;;; Specialty Search Routines
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1262 (defun semanticdb-find-tags-external-children-of-type
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1263 (type &optional path find-file-match)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1264 "Search for all tags defined outside of TYPE w/ TYPE as a parent.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1265 See `semanticdb-find-translate-path' for details on PATH.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1266 FIND-FILE-MATCH indicates that any time a match is found, the file
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1267 associated with that tag should be loaded into a buffer."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1268 (semanticdb-find-tags-collector
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1269 (lambda (table tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1270 (semanticdb-find-tags-external-children-of-type-method table type tags))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1271 path find-file-match))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1272
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1273 (defun semanticdb-find-tags-subclasses-of-type
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1274 (type &optional path find-file-match)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1275 "Search for all tags of class type defined that subclass TYPE.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1276 See `semanticdb-find-translate-path' for details on PATH.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1277 FIND-FILE-MATCH indicates that any time a match is found, the file
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1278 associated with that tag should be loaded into a buffer."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1279 (semanticdb-find-tags-collector
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1280 (lambda (table tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1281 (semanticdb-find-tags-subclasses-of-type-method table type tags))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1282 path find-file-match t))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1283
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1284 ;;; METHODS
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1285 ;;
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1286 ;; Default methods for semanticdb database and table objects.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1287 ;; Override these with system databases to as new types of back ends.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1288
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1289 ;;; Top level Searches
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1290 (defmethod semanticdb-find-tags-by-name-method ((table semanticdb-abstract-table) name &optional tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1291 "In TABLE, find all occurances of tags with NAME.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1292 Optional argument TAGS is a list of tags to search.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1293 Returns a table of all matching tags."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1294 (semantic-find-tags-by-name name (or tags (semanticdb-get-tags table))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1295
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1296 (defmethod semanticdb-find-tags-by-name-regexp-method ((table semanticdb-abstract-table) regexp &optional tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1297 "In TABLE, find all occurances of tags matching REGEXP.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1298 Optional argument TAGS is a list of tags to search.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1299 Returns a table of all matching tags."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1300 (semantic-find-tags-by-name-regexp regexp (or tags (semanticdb-get-tags table))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1301
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1302 (defmethod semanticdb-find-tags-for-completion-method ((table semanticdb-abstract-table) prefix &optional tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1303 "In TABLE, find all occurances of tags matching PREFIX.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1304 Optional argument TAGS is a list of tags to search.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1305 Returns a table of all matching tags."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1306 (semantic-find-tags-for-completion prefix (or tags (semanticdb-get-tags table))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1307
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1308 (defmethod semanticdb-find-tags-by-class-method ((table semanticdb-abstract-table) class &optional tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1309 "In TABLE, find all occurances of tags of CLASS.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1310 Optional argument TAGS is a list of tags to search.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1311 Returns a table of all matching tags."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1312 (semantic-find-tags-by-class class (or tags (semanticdb-get-tags table))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1313
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1314 (defmethod semanticdb-find-tags-external-children-of-type-method ((table semanticdb-abstract-table) parent &optional tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1315 "In TABLE, find all occurances of tags whose parent is the PARENT type.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1316 Optional argument TAGS is a list of tags to search.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1317 Returns a table of all matching tags."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1318 (semantic-find-tags-external-children-of-type parent (or tags (semanticdb-get-tags table))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1319
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1320 (defmethod semanticdb-find-tags-subclasses-of-type-method ((table semanticdb-abstract-table) parent &optional tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1321 "In TABLE, find all occurances of tags whose parent is the PARENT type.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1322 Optional argument TAGS is a list of tags to search.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1323 Returns a table of all matching tags."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1324 (semantic-find-tags-subclasses-of-type parent (or tags (semanticdb-get-tags table))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1325
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1326 ;;; Deep Searches
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1327 (defmethod semanticdb-deep-find-tags-by-name-method ((table semanticdb-abstract-table) name &optional tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1328 "In TABLE, find all occurances of tags with NAME.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1329 Search in all tags in TABLE, and all components of top level tags in
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1330 TABLE.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1331 Optional argument TAGS is a list of tags to search.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1332 Return a table of all matching tags."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1333 (semantic-find-tags-by-name name (semantic-flatten-tags-table (or tags (semanticdb-get-tags table)))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1334
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1335 (defmethod semanticdb-deep-find-tags-by-name-regexp-method ((table semanticdb-abstract-table) regexp &optional tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1336 "In TABLE, find all occurances of tags matching REGEXP.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1337 Search in all tags in TABLE, and all components of top level tags in
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1338 TABLE.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1339 Optional argument TAGS is a list of tags to search.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1340 Return a table of all matching tags."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1341 (semantic-find-tags-by-name-regexp regexp (semantic-flatten-tags-table (or tags (semanticdb-get-tags table)))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1342
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1343 (defmethod semanticdb-deep-find-tags-for-completion-method ((table semanticdb-abstract-table) prefix &optional tags)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1344 "In TABLE, find all occurances of tags matching PREFIX.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1345 Search in all tags in TABLE, and all components of top level tags in
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1346 TABLE.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1347 Optional argument TAGS is a list of tags to search.
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1348 Return a table of all matching tags."
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1349 (semantic-find-tags-for-completion prefix (semantic-flatten-tags-table (or tags (semanticdb-get-tags table)))))
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1350
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1351 (provide 'semantic/db-find)
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1352
6810f0d84270 cedet/semantic/ctxt.el, cedet/semantic/db-find.el,
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1353 ;;; semanticdb-find.el ends here