1 ;;; semantic/db-find.el --- Searching through semantic databases.
3 ;; Copyright (C) 2000-2011 Free Software Foundation, Inc.
5 ;; Author: Eric M. Ludlam <zappo@gnu.org>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
25 ;; Databases of various forms can all be searched.
26 ;; There are a few types of searches that can be done:
29 ;; These searches scan a database table collection for tags based
32 ;; Basic Attribute Search:
33 ;; These searches allow searching on specific attributes of tags,
34 ;; such as name, type, or other attribute.
37 ;; These are searches that were needed to accomplish some
38 ;; specialized tasks as discovered in utilities. Advanced searches
39 ;; include matching methods defined outside some parent class.
41 ;; The reason for advanced searches are so that external
42 ;; repositories such as the Emacs obarray, or java .class files can
43 ;; quickly answer these needed questions without dumping the entire
44 ;; symbol list into Emacs for additional refinement searches via
45 ;; regular semanticdb search.
47 ;; How databases are decided upon is another important aspect of a
48 ;; database search. When it comes to searching for a name, there are
49 ;; these types of searches:
52 ;; Basic search means that tags looking for a given name start
53 ;; with a specific search path. Names are sought on that path
54 ;; until it is empty or items on the path can no longer be found.
55 ;; Use `semanticdb-dump-all-table-summary' to test this list.
56 ;; Use `semanticdb-find-throttle-custom-list' to refine this list.
59 ;; A deep search will search more than just the global namespace.
60 ;; It will recurse into tags that contain more tags, and search
64 ;; Brute search means that all tables in all databases in a given
65 ;; project are searched. Brute searches are the search style as
66 ;; written for semantic version 1.x.
68 ;; How does the search path work?
70 ;; A basic search starts with three parameters:
72 ;; (FINDME &optional PATH FIND-FILE-MATCH)
74 ;; FINDME is key to be searched for dependent on the type of search.
75 ;; PATH is an indicator of which tables are to be searched.
76 ;; FIND-FILE-MATCH indicates that any time a match is found, the
77 ;; file associated with the tag should be read into a file.
79 ;; The PATH argument is then the most interesting argument. It can
82 ;; nil - Take the current buffer, and use it's include list
83 ;; buffer - Use that buffer's include list.
84 ;; filename - Use that file's include list. If the file is not
85 ;; in a buffer, see of there is a semanticdb table for it. If
86 ;; not, read that file into a buffer.
87 ;; tag - Get that tag's buffer of file file. See above.
88 ;; table - Search that table, and it's include list.
92 ;; Semanticdb returns the results in a specific format. There are a
93 ;; series of routines for using those results, and results can be
94 ;; passed in as a search-path for refinement searches with
95 ;; semanticdb. Apropos for semanticdb.*find-result for more.
99 ;; Here are applications where different searches are needed which
100 ;; exist as of semantic 1.4.x
102 ;; eldoc - popup help
103 ;; => Requires basic search using default path. (Header files ok)
104 ;; tag jump - jump to a named tag
105 ;; => Requires a brute search using whole project. (Source files only)
106 ;; completion - Completing symbol names in a smart way
107 ;; => Basic search (headers ok)
108 ;; type analysis - finding type definitions for variables & fcns
109 ;; => Basic search (headers ok)
110 ;; Class browser - organize types into some structure
111 ;; => Brute search, or custom navigation.
114 ;; During a search, load any unloaded DB files based on paths in the
117 (require 'semantic
/db
)
118 (require 'semantic
/db-ref
)
120 (require 'semantic
/find
))
124 (defvar data-debug-thing-alist
)
125 (declare-function data-debug-insert-stuff-list
"data-debug")
126 ;;;(declare-function data-debug-insert-tag-list "adebug")
127 (declare-function semantic-scope-reset-cache
"semantic/scope")
128 (declare-function semanticdb-typecache-notify-reset
"semantic/db-typecache")
129 (declare-function ede-current-project
"ede")
131 (defvar semanticdb-find-throttle-custom-list
132 '(repeat (radio (const 'local
)
137 (const 'omniscience
)))
138 "Customization values for semanticdb find throttle.
139 See `semanticdb-find-throttle' for details.")
142 (defcustom semanticdb-find-default-throttle
143 '(local project unloaded system recursive
)
144 "The default throttle for `semanticdb-find' routines.
145 The throttle controls how detailed the list of database
146 tables is for a symbol lookup. The value is a list with
148 `file' - The file the search is being performed from.
149 This option is here for completeness only, and
150 is assumed to always be on.
151 `local' - Tables from the same local directory are included.
152 This includes files directly referenced by a file name
153 which might be in a different directory.
154 `project' - Tables from the same local project are included
155 If `project' is specified, then `local' is assumed.
156 `unloaded' - If a table is not in memory, load it. If it is not cached
157 on disk either, get the source, parse it, and create
159 `system' - Tables from system databases. These are specifically
160 tables from system header files, or language equivalent.
161 `recursive' - For include based searches, includes tables referenced
163 `omniscience' - Included system databases which are omniscience, or
164 somehow know everything. Omniscience databases are found
165 in `semanticdb-project-system-databases'.
166 The Emacs Lisp system DB is an omniscience database."
168 :type semanticdb-find-throttle-custom-list
)
170 (defun semanticdb-find-throttle-active-p (access-type)
171 "Non-nil if ACCESS-TYPE is an active throttle type."
172 (or (memq access-type semanticdb-find-default-throttle
)
173 (eq access-type
'file
)
174 (and (eq access-type
'local
)
175 (memq 'project semanticdb-find-default-throttle
))
180 ;; The find routines spend a lot of time looking stuff up.
181 ;; Use this handy search index to cache data between searches.
182 ;; This should allow searches to start running faster.
183 (defclass semanticdb-find-search-index
(semanticdb-abstract-search-index)
184 ((include-path :initform nil
186 "List of semanticdb tables from the include path.")
187 (type-cache :initform nil
189 "Cache of all the data types accessible from this file.
190 Includes all types from all included files, merged namespaces, and
191 expunge duplicates.")
193 "Concrete search index for `semanticdb-find'.
194 This class will cache data derived during various searches.")
196 (defmethod semantic-reset ((idx semanticdb-find-search-index
))
197 "Reset the object IDX."
198 (require 'semantic
/scope
)
199 ;; Clear the include path.
200 (oset idx include-path nil
)
201 (when (oref idx type-cache
)
202 (semantic-reset (oref idx type-cache
)))
203 ;; Clear the scope. Scope doesn't have the data it needs to track
205 (semantic-scope-reset-cache)
208 (defmethod semanticdb-synchronize ((idx semanticdb-find-search-index
)
210 "Synchronize the search index IDX with some NEW-TAGS."
213 ;; Notify dependants by clearning their indicies.
214 (semanticdb-notify-references
217 (semantic-reset (semanticdb-get-table-index tab
))))
220 (defmethod semanticdb-partial-synchronize ((idx semanticdb-find-search-index
)
222 "Synchronize the search index IDX with some changed NEW-TAGS."
223 ;; Only reset if include statements changed.
224 (if (semantic-find-tags-by-class 'include new-tags
)
227 ;; Notify dependants by clearning their indicies.
228 (semanticdb-notify-references
231 (semantic-reset (semanticdb-get-table-index tab
))))
233 ;; Else, not an include, by just a type.
234 (when (oref idx type-cache
)
235 (when (semanticdb-partial-synchronize (oref idx type-cache
) new-tags
)
236 ;; If the synchronize returns true, we need to notify.
237 ;; Notify dependants by clearning their indicies.
238 (semanticdb-notify-references
241 (let ((tab-idx (semanticdb-get-table-index tab
)))
243 (when (oref tab-idx type-cache
)
244 (require 'db-typecache
)
245 (semanticdb-typecache-notify-reset
246 (oref tab-idx type-cache
)))
252 ;;; Path Translations
254 ;;; OVERLOAD Functions
256 ;; These routines needed to be overloaded by specific language modes.
257 ;; They are needed for translating an INCLUDE tag into a semanticdb
260 (define-overloadable-function semanticdb-find-translate-path
(path brutish
)
261 "Translate PATH into a list of semantic tables.
262 Path translation involves identifying the PATH input argument
263 in one of the following ways:
264 nil - Take the current buffer, and use its include list
265 buffer - Use that buffer's include list.
266 filename - Use that file's include list. If the file is not
267 in a buffer, see of there is a semanticdb table for it. If
268 not, read that file into a buffer.
269 tag - Get that tag's buffer of file file. See above.
270 table - Search that table, and its include list.
271 find result - Search the results of a previous find.
273 In addition, once the base path is found, there is the possibility of
274 each added table adding yet more tables to the path, so this routine
275 can return a lengthy list.
277 If argument BRUTISH is non-nil, then instead of using the include
278 list, use all tables found in the parent project of the table
279 identified by translating PATH. Such searches use brute force to
280 scan every available table.
282 The return value is a list of objects of type `semanticdb-table' or
283 their children. In the case of passing in a find result, the result
284 is returned unchanged.
286 This routine uses `semanticdb-find-table-for-include' to translate
287 specific include tags into a semanticdb table.
289 Note: When searching using a non-brutish method, the list of
290 included files will be cached between runs. Database-references
291 are used to track which files need to have their include lists
292 refreshed when things change. See `semanticdb-ref-test'.
294 Note for overloading: If you opt to overload this function for your
295 major mode, and your routine takes a long time, be sure to call
297 (semantic-throw-on-input 'your-symbol-here)
299 so that it can be called from the idle work handler."
302 (defun semanticdb-find-translate-path-default (path brutish
)
303 "Translate PATH into a list of semantic tables.
304 If BRUTISH is non nil, return all tables associated with PATH.
305 Default action as described in `semanticdb-find-translate-path'."
306 (if (semanticdb-find-results-p path
)
307 ;; nil means perform the search over these results.
310 (semanticdb-find-translate-path-brutish-default path
)
311 (semanticdb-find-translate-path-includes-default path
))))
314 (define-overloadable-function semanticdb-find-table-for-include
(includetag &optional table
)
315 "For a single INCLUDETAG found in TABLE, find a `semanticdb-table' object
316 INCLUDETAG is a semantic TAG of class 'include.
317 TABLE is a semanticdb table that identifies where INCLUDETAG came from.
318 TABLE is optional if INCLUDETAG has an overlay of :filename attribute."
321 (defun semanticdb-find-translate-path-brutish-default (path)
322 "Translate PATH into a list of semantic tables.
323 Default action as described in `semanticdb-find-translate-path'."
325 (cond ((null path
) semanticdb-current-database
)
326 ((semanticdb-table-p path
) (oref path parent-db
))
327 (t (let ((tt (semantic-something-to-tag-table path
)))
328 ;; @todo - What does this DO ??!?!
329 (with-current-buffer (semantic-tag-buffer (car tt
))
330 semanticdb-current-database
))))))
335 (let ((tabs (semanticdb-get-database-tables db
))
337 ;; Only return tables of the same language (major-mode)
338 ;; as the current search environment.
341 (semantic-throw-on-input 'translate-path-brutish
)
343 (if (semanticdb-equivalent-mode-for-search (car tabs
)
345 (setq ret
(cons (car tabs
) ret
)))
346 (setq tabs
(cdr tabs
)))
349 ;; This should scan the current project directory list for all
350 ;; semanticdb files, perhaps handling proxies for them.
351 (semanticdb-current-database-list
352 (if basedb
(oref basedb reference-directory
)
353 default-directory
))))
356 (defun semanticdb-find-incomplete-cache-entries-p (cache)
357 "Are there any incomplete entries in CACHE?"
360 (when (and (semanticdb-table-child-p tab
)
361 (not (number-or-marker-p (oref tab pointmax
))))
366 (defun semanticdb-find-need-cache-update-p (table)
367 "Non-nil if the semanticdb TABLE cache needs to be updated."
368 ;; If we were passed in something related to a TABLE,
369 ;; do a caching lookup.
370 (let* ((index (semanticdb-get-table-index table
))
371 (cache (when index
(oref index include-path
)))
372 (incom (semanticdb-find-incomplete-cache-entries-p cache
))
373 (unl (semanticdb-find-throttle-active-p 'unloaded
))
376 cache
;; Must have a cache
378 ;; If all entries are "full", or if 'unloaded
380 ;; is not in the throttle, it is ok to use the cache.
381 (not incom
) (not unl
)
387 ;; We need an update.
391 (defun semanticdb-find-translate-path-includes-default (path)
392 "Translate PATH into a list of semantic tables.
393 Default action as described in `semanticdb-find-translate-path'."
394 (let ((table (cond ((null path
)
395 semanticdb-current-table
)
397 (semantic-buffer-local-value 'semanticdb-current-table path
))
398 ((and (stringp path
) (file-exists-p path
))
399 (semanticdb-file-table-object path t
))
400 ((semanticdb-abstract-table-child-p path
)
404 ;; If we were passed in something related to a TABLE,
405 ;; do a caching lookup.
406 (let ((index (semanticdb-get-table-index table
)))
407 (if (semanticdb-find-need-cache-update-p table
)
408 ;; Lets go look up our indicies
409 (let ((ans (semanticdb-find-translate-path-includes--internal path
)))
410 (oset index include-path ans
)
411 ;; Once we have our new indicies set up, notify those
412 ;; who depend on us if we found something for them to
414 (when ans
(semanticdb-refresh-references table
))
418 ;; Just return the cache.
419 (oref index include-path
)))
420 ;; If we were passed in something like a tag list, or other boring
421 ;; searchable item, then instead do the regular thing without caching.
422 (semanticdb-find-translate-path-includes--internal path
))))
424 (defvar semanticdb-find-lost-includes nil
425 "Include files that we cannot find associated with this buffer.")
426 (make-variable-buffer-local 'semanticdb-find-lost-includes
)
428 (defvar semanticdb-find-scanned-include-tags nil
429 "All include tags scanned, plus action taken on the tag.
430 Each entry is an alist:
432 where ACTION is one of 'scanned, 'duplicate, 'lost
433 and TAG is a clone of the include tag that was found.")
434 (make-variable-buffer-local 'semanticdb-find-scanned-include-tags
)
436 (defvar semanticdb-implied-include-tags nil
437 "Include tags implied for all files of a given mode.
438 Set this variable with `defvar-mode-local' for a particular mode so
439 that any symbols that exist for all files for that mode are included.
441 Note: This could be used as a way to write a file in a language
442 to declare all the built-ins for that language.")
444 (defun semanticdb-find-translate-path-includes--internal (path)
445 "Internal implementation of `semanticdb-find-translate-path-includes-default'.
446 This routine does not depend on the cache, but will always derive
447 a new path from the provided PATH."
448 (let ((includetags nil
)
450 (matchedtables (list semanticdb-current-table
))
451 (matchedincludes nil
)
453 (scannedincludes nil
)
457 (semantic-refresh-tags-safe)
458 (setq includetags
(append
459 (semantic-find-tags-included (current-buffer))
460 semanticdb-implied-include-tags
)
461 curtable semanticdb-current-table
462 incfname
(buffer-file-name))
464 ((semanticdb-table-p path
)
465 (setq includetags
(semantic-find-tags-included path
)
467 incfname
(semanticdb-full-filename path
))
470 (with-current-buffer path
471 (semantic-refresh-tags-safe))
472 (setq includetags
(semantic-find-tags-included path
)
473 curtable
(with-current-buffer path
474 semanticdb-current-table
)
475 incfname
(buffer-file-name path
)))
477 (setq includetags
(semantic-find-tags-included path
))
479 ;; If we have some tags, derive a table from them.
480 ;; else we will do nothing, so the table is useless.
482 ;; @todo - derive some tables
483 (message "Need to derive tables for %S in translate-path-includes--default."
487 ;; Make sure each found include tag has an originating file name associated
490 (dolist (it includetags
)
491 (semantic--tag-put-property it
:filename incfname
)))
493 ;; Loop over all include tags adding to matchedtables
495 (semantic-throw-on-input 'semantic-find-translate-path-includes-default
)
497 ;; If we've seen this include string before, lets skip it.
498 (if (member (semantic-tag-name (car includetags
)) matchedincludes
)
501 (push (cons 'duplicate
(semantic-tag-clone (car includetags
)))
504 (setq nexttable
(semanticdb-find-table-for-include (car includetags
) curtable
))
505 (when (not nexttable
)
506 ;; Save the lost include.
507 (push (car includetags
) lostincludes
)
508 (push (cons 'lost
(semantic-tag-clone (car includetags
)))
513 ;; Push the include file, so if we can't find it, we only
514 ;; can't find it once.
515 (push (semantic-tag-name (car includetags
)) matchedincludes
)
517 ;; (message "Scanning %s" (semantic-tag-name (car includetags)))
519 (not (memq nexttable matchedtables
))
520 (semanticdb-equivalent-mode-for-search nexttable
523 ;; Add to list of tables
524 (push nexttable matchedtables
)
526 ;; Queue new includes to list
527 (if (semanticdb-find-throttle-active-p 'recursive
)
528 ;; @todo - recursive includes need to have the originating
529 ;; buffer's location added to the path.
532 ((semanticdb-table-p nexttable
)
533 (semanticdb-refresh-table nexttable
)
534 ;; Use the method directly, or we will recurse
535 ;; into ourselves here.
536 (semanticdb-find-tags-by-class-method
538 (t ;; @todo - is this ever possible???
539 (message "semanticdb-ftp - how did you do that?")
540 (semantic-find-tags-included
541 (semanticdb-get-tags nexttable
)))
543 (newincfname (semanticdb-full-filename nexttable
))
546 (push (cons 'scanned
(semantic-tag-clone (car includetags
)))
549 ;; Setup new tags so we know where they are.
551 (semantic--tag-put-property it
:filename
554 (setq includetags
(nconc includetags newtags
)))
555 ;; ELSE - not recursive throttle
556 (push (cons 'scanned-no-recurse
557 (semantic-tag-clone (car includetags
)))
561 (setq includetags
(cdr includetags
)))
563 (setq semanticdb-find-lost-includes lostincludes
)
564 (setq semanticdb-find-scanned-include-tags
(reverse scannedincludes
))
566 ;; Find all the omniscient databases for this major mode, and
567 ;; add them if needed
568 (when (and (semanticdb-find-throttle-active-p 'omniscience
)
569 semanticdb-search-system-databases
)
570 ;; We can append any mode-specific omniscience databases into
571 ;; our search list here.
572 (let ((systemdb semanticdb-project-system-databases
)
575 (setq ans
(semanticdb-file-table
577 ;; I would expect most omniscient to return the same
578 ;; thing reguardless of filename, but we may have
579 ;; one that can return a table of all things the
580 ;; current file needs.
581 (buffer-file-name (current-buffer))))
582 (when (not (memq ans matchedtables
))
583 (setq matchedtables
(cons ans matchedtables
)))
584 (setq systemdb
(cdr systemdb
))))
586 (nreverse matchedtables
)))
588 (define-overloadable-function semanticdb-find-load-unloaded
(filename)
589 "Create a database table for FILENAME if it hasn't been parsed yet.
590 Assumes that FILENAME exists as a source file.
591 Assumes that a preexisting table does not exist, even if it
592 isn't in memory yet."
593 (if (semanticdb-find-throttle-active-p 'unloaded
)
595 (semanticdb-file-table-object filename t
)))
597 (defun semanticdb-find-load-unloaded-default (filename)
598 "Load an unloaded file in FILENAME using the default semanticdb loader."
599 (semanticdb-file-table-object filename
))
601 ;; The creation of the overload occurs above.
602 (defun semanticdb-find-table-for-include-default (includetag &optional table
)
603 "Default implementation of `semanticdb-find-table-for-include'.
604 Uses `semanticdb-current-database-list' as the search path.
605 INCLUDETAG and TABLE are documented in `semanticdb-find-table-for-include'.
606 Included databases are filtered based on `semanticdb-find-default-throttle'."
607 (if (not (eq (semantic-tag-class includetag
) 'include
))
608 (signal 'wrong-type-argument
(list includetag
'include
)))
611 ;; Note, some languages (like Emacs or Java) use include tag names
612 ;; that don't represent files! We want to have file names.
613 (semantic-tag-include-filename includetag
))
619 ;; INCLUDETAG should have some way to reference where it came
620 ;; from! If not, TABLE should provide the way. Each time we
621 ;; look up a tag, we may need to find it in some relative way
622 ;; and must set our current buffer eto the origin of includetag
623 ;; or nothing may work.
625 (cond ((semantic-tag-file-name includetag
)
626 ;; A tag may have a buffer, or a :filename property.
627 (file-name-directory (semantic-tag-file-name includetag
)))
629 (file-name-directory (semanticdb-full-filename table
)))
631 ;; @todo - what to do here? Throw an error maybe
632 ;; and fix usage bugs?
636 ;; Step 1: Relative path name
638 ;; If the name is relative, then it should be findable as relative
639 ;; to the source file that this tag originated in, and be fast.
641 ((and (semanticdb-find-throttle-active-p 'local
)
642 (file-exists-p (expand-file-name name originfiledir
)))
644 (setq ans
(semanticdb-find-load-unloaded
645 (expand-file-name name originfiledir
)))
647 ;; Step 2: System or Project level includes
650 ;; First, if it a system include, we can investigate that tags
652 (and (semanticdb-find-throttle-active-p 'system
)
654 ;; Sadly, not all languages make this distinction.
655 ;;(semantic-tag-include-system-p includetag)
657 ;; Here, we get local and system files.
658 (setq tmp
(semantic-dependency-tag-file includetag
))
660 ;; Second, project files are active, we and we have EDE,
661 ;; we can find it using the same tool.
662 (and (semanticdb-find-throttle-active-p 'project
)
663 ;; Make sure EDE is available, and we have a project
664 (featurep 'ede
) (ede-current-project originfiledir
)
665 ;; The EDE query is hidden in this call.
666 (setq tmp
(semantic-dependency-tag-file includetag
))
669 (setq ans
(semanticdb-find-load-unloaded tmp
))
671 ;; Somewhere in our project hierarchy
673 ;; Remember: Roots includes system databases which can create
674 ;; specialized tables we can search.
676 ;; NOTE: Not used if EDE is active!
677 ((and (semanticdb-find-throttle-active-p 'project
)
678 ;; And dont do this if it is a system include. Not supported by all languages,
679 ;; but when it is, this is a nice fast way to skip this step.
680 (not (semantic-tag-include-system-p includetag
))
681 ;; Don't do this if we have an EDE project.
682 (not (and (featurep 'ede
)
683 ;; Note: We don't use originfiledir here because
684 ;; we want to know about the source file we are
686 (ede-current-project)))
689 (setq roots
(semanticdb-current-database-list))
691 (while (and (not ans
) roots
)
692 (let* ((ref (if (slot-boundp (car roots
) 'reference-directory
)
693 (oref (car roots
) reference-directory
)))
694 (fname (cond ((null ref
) nil
)
695 ((file-exists-p (expand-file-name name ref
))
696 (expand-file-name name ref
))
697 ((file-exists-p (expand-file-name (file-name-nondirectory name
) ref
))
698 (expand-file-name (file-name-nondirectory name
) ref
)))))
699 (when (and ref fname
)
700 ;; There is an actual file. Grab it.
701 (setq ans
(semanticdb-find-load-unloaded fname
)))
705 ;; NOTE: We used to look up omniscient databases here, but that
706 ;; is now handled one layer up.
708 ;; Missing: a database that knows where missing files are. Hmm.
709 ;; perhaps I need an override function for that?
713 (setq roots
(cdr roots
))))
718 ;;; Perform interactive tests on the path/search mechanisms.
721 (defun semanticdb-find-test-translate-path (&optional arg
)
722 "Call and output results of `semanticdb-find-translate-path'.
723 With ARG non-nil, specify a BRUTISH translation.
724 See `semanticdb-find-default-throttle' and `semanticdb-project-roots'
725 for details on how this list is derived."
727 (semantic-fetch-tags)
728 (require 'data-debug
)
729 (let ((start (current-time))
730 (p (semanticdb-find-translate-path nil arg
))
733 (data-debug-new-buffer "*SEMANTICDB FTP ADEBUG*")
734 (message "Search of tags took %.2f seconds."
735 (semantic-elapsed-time start end
))
737 (data-debug-insert-stuff-list p
"*")))
739 (defun semanticdb-find-test-translate-path-no-loading (&optional arg
)
740 "Call and output results of `semanticdb-find-translate-path'.
741 With ARG non-nil, specify a BRUTISH translation.
742 See `semanticdb-find-default-throttle' and `semanticdb-project-roots'
743 for details on how this list is derived."
745 (semantic-fetch-tags)
746 (require 'data-debug
)
747 (let* ((semanticdb-find-default-throttle
748 (if (featurep 'semantic
/db-find
)
749 (remq 'unloaded semanticdb-find-default-throttle
)
751 (start (current-time))
752 (p (semanticdb-find-translate-path nil arg
))
755 (data-debug-new-buffer "*SEMANTICDB FTP ADEBUG*")
756 (message "Search of tags took %.2f seconds."
757 (semantic-elapsed-time start end
))
759 (data-debug-insert-stuff-list p
"*")))
762 (defun semanticdb-find-adebug-lost-includes ()
763 "Translate the current path, then display the lost includes.
764 Examines the variable `semanticdb-find-lost-includes'."
766 (require 'data-debug
)
767 (semanticdb-find-translate-path nil nil
)
768 (let ((lost semanticdb-find-lost-includes
)
772 (message "There are no unknown includes for %s"
775 (data-debug-new-buffer "*SEMANTICDB lost-includes ADEBUG*")
776 ;; (data-debug-insert-tag-list lost "*")
779 (defun semanticdb-find-adebug-insert-scanned-tag-cons (consdata prefix prebuttontext
)
780 "Insert a button representing scanned include CONSDATA.
781 PREFIX is the text that precedes the button.
782 PREBUTTONTEXT is some text between prefix and the overlay button."
783 (let* ((start (point))
785 (mode (car consdata
))
787 (name (semantic-tag-name tag
))
788 (file (semantic-tag-file-name tag
))
789 (str1 (format "%S %s" mode name
))
790 (str2 (format " : %s" file
))
792 (insert prefix prebuttontext str1
)
795 (put-text-property start end
'face
796 (cond ((eq mode
'scanned
)
797 'font-lock-function-name-face
)
798 ((eq mode
'duplicate
)
799 'font-lock-comment-face
)
801 'font-lock-variable-name-face
)
802 ((eq mode
'scanned-no-recurse
)
803 'font-lock-type-face
)))
804 (put-text-property start end
'ddebug
(cdr consdata
))
805 (put-text-property start end
'ddebug-indent
(length prefix
))
806 (put-text-property start end
'ddebug-prefix prefix
)
807 (put-text-property start end
'help-echo tip
)
808 (put-text-property start end
'ddebug-function
809 'data-debug-insert-tag-parts-from-point
)
814 (defun semanticdb-find-adebug-scanned-includes ()
815 "Translate the current path, then display the lost includes.
816 Examines the variable `semanticdb-find-lost-includes'."
818 (require 'data-debug
)
819 (semanticdb-find-translate-path nil nil
)
820 (let ((scanned semanticdb-find-scanned-include-tags
)
821 (data-debug-thing-alist
823 '((lambda (thing) (and (consp thing
)
824 (symbolp (car thing
))
826 '(scanned scanned-no-recurse
828 . semanticdb-find-adebug-insert-scanned-tag-cons
)
829 data-debug-thing-alist
))
833 (message "There are no includes scanned %s"
836 (data-debug-new-buffer "*SEMANTICDB scanned-includes ADEBUG*")
837 (data-debug-insert-stuff-list scanned
"*")
842 ;; Once you have a search result, use these routines to operate
843 ;; on the search results at a higher level
846 (defun semanticdb-strip-find-results (results &optional find-file-match
)
847 "Strip a semanticdb search RESULTS to exclude objects.
848 This makes it appear more like the results of a `semantic-find-' call.
849 Optional FIND-FILE-MATCH loads all files associated with RESULTS
850 into buffers. This has the side effect of enabling `semantic-tag-buffer' to
852 If FIND-FILE-MATCH is 'name, then only the filename is stored
853 in each tag instead of loading each file into a buffer.
854 If the input RESULTS are not going to be used again, and if
855 FIND-FILE-MATCH is nil, you can use `semanticdb-fast-strip-find-results'
858 ;; Load all files associated with RESULTS.
862 (let ((tab (car (car tmp
)))
863 (tags (cdr (car tmp
))))
865 ;; Normilzation gives specialty database tables a chance
866 ;; to convert into a more stable tag format.
867 (let* ((norm (semanticdb-normalize-one-tag tab T
))
872 ;; If it didn't normalize, use what we had.
875 (setq output
(append output
(list ntag
))))
877 ;; Find-file-match allows a tool to make sure the tag is
878 ;; 'live', somewhere in a buffer.
879 (cond ((eq find-file-match
'name
)
880 (let ((f (semanticdb-full-filename nametable
)))
881 (semantic--tag-put-property ntag
:filename f
)))
882 ((and find-file-match ntab
)
883 (semanticdb-get-buffer ntab
))
887 (setq tmp
(cdr tmp
)))
889 ;; @todo - I could use nconc, but I don't know what the caller may do with
890 ;; RESULTS after this is called. Right now semantic-complete will
891 ;; recycling the input after calling this routine.
892 (apply #'append
(mapcar #'cdr results
))))
894 (defun semanticdb-fast-strip-find-results (results)
895 "Destructively strip a semanticdb search RESULTS to exclude objects.
896 This makes it appear more like the results of a `semantic-find-' call.
897 This is like `semanticdb-strip-find-results', except the input list RESULTS
899 (apply #'nconc
(mapcar #'cdr results
)))
901 (defun semanticdb-find-results-p (resultp)
902 "Non-nil if RESULTP is in the form of a semanticdb search result.
903 This query only really tests the first entry in the list that is RESULTP,
904 but should be good enough for debugging assertions."
906 (listp (car resultp
))
907 (semanticdb-abstract-table-child-p (car (car resultp
)))
908 (or (semantic-tag-p (car (cdr (car resultp
))))
909 (null (car (cdr (car resultp
)))))))
911 (defun semanticdb-find-result-prin1-to-string (result)
912 "Presuming RESULT satisfies `semanticdb-find-results-p', provide a short PRIN1 output."
913 (if (< (length result
) 2)
914 (concat "#<FIND RESULT "
915 (mapconcat (lambda (a)
916 (concat "(" (object-name (car a
) ) " . "
917 "#<TAG LIST " (number-to-string (length (cdr a
))) ">)"))
921 ;; Longer results should have an abreviated form.
922 (format "#<FIND RESULT %d TAGS in %d FILES>"
923 (semanticdb-find-result-length result
)
926 (defun semanticdb-find-result-with-nil-p (resultp)
927 "Non-nil of RESULTP is in the form of a semanticdb search result.
928 The value nil is valid where a TABLE usually is, but only if the TAG
929 results include overlays.
930 This query only really tests the first entry in the list that is RESULTP,
931 but should be good enough for debugging assertions."
933 (listp (car resultp
))
934 (let ((tag-to-test (car-safe (cdr (car resultp
)))))
935 (or (and (semanticdb-abstract-table-child-p (car (car resultp
)))
936 (or (semantic-tag-p tag-to-test
)
938 (and (null (car (car resultp
)))
939 (or (semantic-tag-with-position-p tag-to-test
)
940 (null tag-to-test
))))
944 (defun semanticdb-find-result-length (result)
945 "Number of tags found in RESULT."
947 (mapc (lambda (onetable)
948 (setq count
(+ count
(1- (length onetable
)))))
953 (defun semanticdb-find-result-nth (result n
)
954 "In RESULT, return the Nth search result.
955 This is a 0 based search result, with the first match being element 0.
957 The returned value is a cons cell: (TAG . TABLE) where TAG
958 is the tag at the Nth position. TABLE is the semanticdb table where
959 the TAG was found. Sometimes TABLE can be nil."
962 ;; Loop over each single table hit.
963 (while (and (not ans
) result
)
964 ;; For each table result, get local length, and modify
965 ;; N to be that much less.
966 (let ((ll (length (cdr (car result
))))) ;; local length
968 ;; We have a local match.
969 (setq ans
(nth n
(cdr (car result
)))
970 anstable
(car (car result
)))
971 ;; More to go. Decrement N.
974 (setq result
(cdr result
)))
975 (cons ans anstable
)))
977 (defun semanticdb-find-result-test (result)
978 "Test RESULT by accessing all the tags in the list."
979 (if (not (semanticdb-find-results-p result
))
980 (error "Does not pass `semanticdb-find-results-p.\n"))
981 (let ((len (semanticdb-find-result-length result
))
984 (let ((tag (semanticdb-find-result-nth result i
)))
985 (if (not (semantic-tag-p (car tag
)))
986 (error "%d entry is not a tag" i
)))
990 (defun semanticdb-find-result-nth-in-buffer (result n
)
991 "In RESULT, return the Nth search result.
992 Like `semanticdb-find-result-nth', except that only the TAG
993 is returned, and the buffer it is found it will be made current.
994 If the result tag has no position information, the originating buffer
995 is still made current."
996 (let* ((ret (semanticdb-find-result-nth result n
))
998 (anstable (cdr ret
)))
999 ;; If we have a hit, double-check the find-file
1000 ;; entry. If the file must be loaded, then gat that table's
1001 ;; source file into a buffer.
1004 (let ((norm (semanticdb-normalize-one-tag anstable ans
)))
1006 ;; The normalized tags can now be found based on that
1010 (semanticdb-set-buffer (car norm
))
1012 (setq ans
(cdr norm
)))
1013 ;; Don't error for this case, but don't store
1014 ;; the thing either.
1015 (no-method-definition nil
))
1021 (defun semanticdb-find-result-mapc (fcn result
)
1022 "Apply FCN to each element of find RESULT for side-effects only.
1023 FCN takes two arguments. The first is a TAG, and the
1024 second is a DB from whence TAG originated.
1026 (mapc (lambda (sublst-icky)
1027 (mapc (lambda (tag-icky)
1028 (funcall fcn tag-icky
(car sublst-icky
)))
1035 ;; Basic logging to see what the search routines are doing.
1036 (defvar semanticdb-find-log-flag nil
1037 "Non-nil means log the process of searches.")
1039 (defvar semanticdb-find-log-buffer-name
"*SemanticDB Find Log*"
1040 "The name of the logging buffer.")
1042 (defun semanticdb-find-toggle-logging ()
1043 "Toggle semanticdb logging."
1045 (setq semanticdb-find-log-flag
(null semanticdb-find-log-flag
))
1046 (message "Semanticdb find logging is %sabled"
1047 (if semanticdb-find-log-flag
"en" "dis")))
1049 (defun semanticdb-reset-log ()
1050 "Reset the log buffer."
1052 (when semanticdb-find-log-flag
1053 (with-current-buffer (get-buffer-create semanticdb-find-log-buffer-name
)
1057 (defun semanticdb-find-log-move-to-end ()
1058 "Move to the end of the semantic log."
1059 (let ((cb (current-buffer))
1060 (cw (selected-window)))
1063 (set-buffer semanticdb-find-log-buffer-name
)
1064 (if (get-buffer-window (current-buffer) 'visible
)
1065 (select-window (get-buffer-window (current-buffer) 'visible
)))
1066 (goto-char (point-max)))
1067 (if cw
(select-window cw
))
1070 (defun semanticdb-find-log-new-search (forwhat)
1071 "Start a new search FORWHAT."
1072 (when semanticdb-find-log-flag
1073 (with-current-buffer (get-buffer-create semanticdb-find-log-buffer-name
)
1074 (insert (format "New Search: %S\n" forwhat
))
1076 (semanticdb-find-log-move-to-end)))
1078 (defun semanticdb-find-log-activity (table result
)
1079 "Log that TABLE has been searched and RESULT was found."
1080 (when semanticdb-find-log-flag
1081 (with-current-buffer semanticdb-find-log-buffer-name
1082 (insert "Table: " (object-print table
)
1083 " Result: " (int-to-string (length result
)) " tags"
1086 (semanticdb-find-log-move-to-end)))
1088 ;;; Semanticdb find API functions
1089 ;; These are the routines actually used to perform searches.
1091 (defun semanticdb-find-tags-collector (function &optional path find-file-match
1093 "Collect all tags returned by FUNCTION over PATH.
1094 The FUNCTION must take two arguments. The first is TABLE,
1095 which is a semanticdb table containing tags. The second argument
1096 to FUNCTION is TAGS. TAGS may be a list of tags. If TAGS is non-nil,
1097 then FUNCTION should search the TAG list, not through TABLE.
1099 See `semanticdb-find-translate-path' for details on PATH.
1100 FIND-FILE-MATCH indicates that any time a match is found, the file
1101 associated with that tag should be loaded into a buffer.
1103 Note: You should leave FIND-FILE-MATCH as nil. It is far more
1104 efficient to take the results from any search and use
1105 `semanticdb-strip-find-results' instead. This argument is here
1106 for backward compatibility.
1108 If optional argument BRUTISH is non-nil, then ignore include statements,
1109 and search all tables in this project tree."
1112 ;; If path is a buffer, set ourselves up in that buffer
1113 ;; so that the override methods work correctly.
1114 (when (bufferp path
) (set-buffer path
))
1115 (if (semanticdb-find-results-p path
)
1116 ;; When we get find results, loop over that.
1117 (dolist (tableandtags path
)
1118 (semantic-throw-on-input 'semantic-find-translate-path
)
1119 ;; If FIND-FILE-MATCH is non-nil, skip tables of class
1120 ;; `semanticdb-search-results-table', since those are system
1121 ;; databases and not associated with a file.
1122 (unless (and find-file-match
1124 (car tableandtags
) semanticdb-search-results-table
))
1125 (when (setq match
(funcall function
1126 (car tableandtags
) (cdr tableandtags
)))
1127 (when find-file-match
1128 (save-excursion (semanticdb-set-buffer (car tableandtags
))))
1129 (push (cons (car tableandtags
) match
) found
)))
1131 ;; Only log searches across data bases.
1132 (semanticdb-find-log-new-search nil
)
1133 ;; If we get something else, scan the list of tables resulting
1134 ;; from translating it into a list of objects.
1135 (dolist (table (semanticdb-find-translate-path path brutish
))
1136 (semantic-throw-on-input 'semantic-find-translate-path
)
1137 ;; If FIND-FILE-MATCH is non-nil, skip tables of class
1138 ;; `semanticdb-search-results-table', since those are system
1139 ;; databases and not associated with a file.
1140 (unless (and find-file-match
1141 (obj-of-class-p table semanticdb-search-results-table
))
1142 (when (and table
(setq match
(funcall function table nil
)))
1143 (semanticdb-find-log-activity table match
)
1144 (when find-file-match
1145 (save-excursion (semanticdb-set-buffer table
)))
1146 (push (cons table match
) found
))))))
1147 ;; At this point, FOUND has had items pushed onto it.
1148 ;; This means items are being returned in REVERSE order
1149 ;; of the tables searched, so if you just get th CAR, then
1150 ;; too-bad, you may have some system-tag that has no
1151 ;; buffer associated with it.
1153 ;; It must be reversed.
1157 (defun semanticdb-find-tags-by-name (name &optional path find-file-match
)
1158 "Search for all tags matching NAME on PATH.
1159 See `semanticdb-find-translate-path' for details on PATH.
1160 FIND-FILE-MATCH indicates that any time a match is found, the file
1161 associated with that tag should be loaded into a buffer."
1162 (semanticdb-find-tags-collector
1163 (lambda (table tags
)
1164 (semanticdb-find-tags-by-name-method table name tags
))
1165 path find-file-match
))
1168 (defun semanticdb-find-tags-by-name-regexp (regexp &optional path find-file-match
)
1169 "Search for all tags matching REGEXP on PATH.
1170 See `semanticdb-find-translate-path' for details on PATH.
1171 FIND-FILE-MATCH indicates that any time a match is found, the file
1172 associated with that tag should be loaded into a buffer."
1173 (semanticdb-find-tags-collector
1174 (lambda (table tags
)
1175 (semanticdb-find-tags-by-name-regexp-method table regexp tags
))
1176 path find-file-match
))
1179 (defun semanticdb-find-tags-for-completion (prefix &optional path find-file-match
)
1180 "Search for all tags matching PREFIX on PATH.
1181 See `semanticdb-find-translate-path' for details on PATH.
1182 FIND-FILE-MATCH indicates that any time a match is found, the file
1183 associated with that tag should be loaded into a buffer."
1184 (semanticdb-find-tags-collector
1185 (lambda (table tags
)
1186 (semanticdb-find-tags-for-completion-method table prefix tags
))
1187 path find-file-match
))
1190 (defun semanticdb-find-tags-by-class (class &optional path find-file-match
)
1191 "Search for all tags of CLASS on PATH.
1192 See `semanticdb-find-translate-path' for details on PATH.
1193 FIND-FILE-MATCH indicates that any time a match is found, the file
1194 associated with that tag should be loaded into a buffer."
1195 (semanticdb-find-tags-collector
1196 (lambda (table tags
)
1197 (semanticdb-find-tags-by-class-method table class tags
))
1198 path find-file-match
))
1201 (defun semanticdb-deep-find-tags-by-name (name &optional path find-file-match
)
1202 "Search for all tags matching NAME on PATH.
1203 Search also in all components of top level tags founds.
1204 See `semanticdb-find-translate-path' for details on PATH.
1205 FIND-FILE-MATCH indicates that any time a match is found, the file
1206 associated with that tag should be loaded into a buffer."
1207 (semanticdb-find-tags-collector
1208 (lambda (table tags
)
1209 (semanticdb-deep-find-tags-by-name-method table name tags
))
1210 path find-file-match
))
1212 (defun semanticdb-deep-find-tags-by-name-regexp (regexp &optional path find-file-match
)
1213 "Search for all tags matching REGEXP on PATH.
1214 Search also in all components of top level tags founds.
1215 See `semanticdb-find-translate-path' for details on PATH.
1216 FIND-FILE-MATCH indicates that any time a match is found, the file
1217 associated with that tag should be loaded into a buffer."
1218 (semanticdb-find-tags-collector
1219 (lambda (table tags
)
1220 (semanticdb-deep-find-tags-by-name-regexp-method table regexp tags
))
1221 path find-file-match
))
1223 (defun semanticdb-deep-find-tags-for-completion (prefix &optional path find-file-match
)
1224 "Search for all tags matching PREFIX on PATH.
1225 Search also in all components of top level tags founds.
1226 See `semanticdb-find-translate-path' for details on PATH.
1227 FIND-FILE-MATCH indicates that any time a match is found, the file
1228 associated with that tag should be loaded into a buffer."
1229 (semanticdb-find-tags-collector
1230 (lambda (table tags
)
1231 (semanticdb-deep-find-tags-for-completion-method table prefix tags
))
1232 path find-file-match
))
1234 ;;; Brutish Search Routines
1236 (defun semanticdb-brute-deep-find-tags-by-name (name &optional path find-file-match
)
1237 "Search for all tags matching NAME on PATH.
1238 See `semanticdb-find-translate-path' for details on PATH.
1239 The argument BRUTISH will be set so that searching includes all tables
1240 in the current project.
1241 FIND-FILE-MATCH indicates that any time a match is found, the file
1242 associated wit that tag should be loaded into a buffer."
1243 (semanticdb-find-tags-collector
1244 (lambda (table tags
)
1245 (semanticdb-deep-find-tags-by-name-method table name tags
))
1246 path find-file-match t
))
1248 (defun semanticdb-brute-deep-find-tags-for-completion (prefix &optional path find-file-match
)
1249 "Search for all tags matching PREFIX on PATH.
1250 See `semanticdb-find-translate-path' for details on PATH.
1251 The argument BRUTISH will be set so that searching includes all tables
1252 in the current project.
1253 FIND-FILE-MATCH indicates that any time a match is found, the file
1254 associated wit that tag should be loaded into a buffer."
1255 (semanticdb-find-tags-collector
1256 (lambda (table tags
)
1257 (semanticdb-deep-find-tags-for-completion-method table prefix tags
))
1258 path find-file-match t
))
1260 (defun semanticdb-brute-find-tags-by-class (class &optional path find-file-match
)
1261 "Search for all tags of CLASS on PATH.
1262 See `semanticdb-find-translate-path' for details on PATH.
1263 The argument BRUTISH will be set so that searching includes all tables
1264 in the current project.
1265 FIND-FILE-MATCH indicates that any time a match is found, the file
1266 associated with that tag should be loaded into a buffer."
1267 (semanticdb-find-tags-collector
1268 (lambda (table tags
)
1269 (semanticdb-find-tags-by-class-method table class tags
))
1270 path find-file-match t
))
1272 ;;; Specialty Search Routines
1273 (defun semanticdb-find-tags-external-children-of-type
1274 (type &optional path find-file-match
)
1275 "Search for all tags defined outside of TYPE w/ TYPE as a parent.
1276 See `semanticdb-find-translate-path' for details on PATH.
1277 FIND-FILE-MATCH indicates that any time a match is found, the file
1278 associated with that tag should be loaded into a buffer."
1279 (semanticdb-find-tags-collector
1280 (lambda (table tags
)
1281 (semanticdb-find-tags-external-children-of-type-method table type tags
))
1282 path find-file-match
))
1284 (defun semanticdb-find-tags-subclasses-of-type
1285 (type &optional path find-file-match
)
1286 "Search for all tags of class type defined that subclass TYPE.
1287 See `semanticdb-find-translate-path' for details on PATH.
1288 FIND-FILE-MATCH indicates that any time a match is found, the file
1289 associated with that tag should be loaded into a buffer."
1290 (semanticdb-find-tags-collector
1291 (lambda (table tags
)
1292 (semanticdb-find-tags-subclasses-of-type-method table type tags
))
1293 path find-file-match t
))
1297 ;; Default methods for semanticdb database and table objects.
1298 ;; Override these with system databases to as new types of back ends.
1300 ;;; Top level Searches
1301 (defmethod semanticdb-find-tags-by-name-method ((table semanticdb-abstract-table
) name
&optional tags
)
1302 "In TABLE, find all occurrences of tags with NAME.
1303 Optional argument TAGS is a list of tags to search.
1304 Returns a table of all matching tags."
1305 (semantic-find-tags-by-name name
(or tags
(semanticdb-get-tags table
))))
1307 (defmethod semanticdb-find-tags-by-name-regexp-method ((table semanticdb-abstract-table
) regexp
&optional tags
)
1308 "In TABLE, find all occurrences of tags matching REGEXP.
1309 Optional argument TAGS is a list of tags to search.
1310 Returns a table of all matching tags."
1311 (semantic-find-tags-by-name-regexp regexp
(or tags
(semanticdb-get-tags table
))))
1313 (defmethod semanticdb-find-tags-for-completion-method ((table semanticdb-abstract-table
) prefix
&optional tags
)
1314 "In TABLE, find all occurrences of tags matching PREFIX.
1315 Optional argument TAGS is a list of tags to search.
1316 Returns a table of all matching tags."
1317 (semantic-find-tags-for-completion prefix
(or tags
(semanticdb-get-tags table
))))
1319 (defmethod semanticdb-find-tags-by-class-method ((table semanticdb-abstract-table
) class
&optional tags
)
1320 "In TABLE, find all occurrences of tags of CLASS.
1321 Optional argument TAGS is a list of tags to search.
1322 Returns a table of all matching tags."
1323 (semantic-find-tags-by-class class
(or tags
(semanticdb-get-tags table
))))
1325 (defmethod semanticdb-find-tags-external-children-of-type-method ((table semanticdb-abstract-table
) parent
&optional tags
)
1326 "In TABLE, find all occurrences of tags whose parent is the PARENT type.
1327 Optional argument TAGS is a list of tags to search.
1328 Returns a table of all matching tags."
1329 (require 'semantic
/find
)
1330 (semantic-find-tags-external-children-of-type parent
(or tags
(semanticdb-get-tags table
))))
1332 (defmethod semanticdb-find-tags-subclasses-of-type-method ((table semanticdb-abstract-table
) parent
&optional tags
)
1333 "In TABLE, find all occurrences of tags whose parent is the PARENT type.
1334 Optional argument TAGS is a list of tags to search.
1335 Returns a table of all matching tags."
1336 (require 'semantic
/find
)
1337 (semantic-find-tags-subclasses-of-type parent
(or tags
(semanticdb-get-tags table
))))
1340 (defmethod semanticdb-deep-find-tags-by-name-method ((table semanticdb-abstract-table
) name
&optional tags
)
1341 "In TABLE, find all occurrences of tags with NAME.
1342 Search in all tags in TABLE, and all components of top level tags in
1344 Optional argument TAGS is a list of tags to search.
1345 Return a table of all matching tags."
1346 (semantic-find-tags-by-name name
(semantic-flatten-tags-table (or tags
(semanticdb-get-tags table
)))))
1348 (defmethod semanticdb-deep-find-tags-by-name-regexp-method ((table semanticdb-abstract-table
) regexp
&optional tags
)
1349 "In TABLE, find all occurrences of tags matching REGEXP.
1350 Search in all tags in TABLE, and all components of top level tags in
1352 Optional argument TAGS is a list of tags to search.
1353 Return a table of all matching tags."
1354 (semantic-find-tags-by-name-regexp regexp
(semantic-flatten-tags-table (or tags
(semanticdb-get-tags table
)))))
1356 (defmethod semanticdb-deep-find-tags-for-completion-method ((table semanticdb-abstract-table
) prefix
&optional tags
)
1357 "In TABLE, find all occurrences of tags matching PREFIX.
1358 Search in all tags in TABLE, and all components of top level tags in
1360 Optional argument TAGS is a list of tags to search.
1361 Return a table of all matching tags."
1362 (semantic-find-tags-for-completion prefix
(semantic-flatten-tags-table (or tags
(semanticdb-get-tags table
)))))
1364 (provide 'semantic
/db-find
)
1367 ;; generated-autoload-file: "loaddefs.el"
1368 ;; generated-autoload-load-name: "semantic/db-find"
1371 ;;; semantic/db-find.el ends here