>>> Stuart Popejoy <stuart@...> seems to think that:
>Hi,
>
>I'm trying to get semanticdb to do lookups across multiple directories
>in a given project, and am somewhat stymied by the docs. I have a few
>questions:
There are different ways to do this. The simplest is to set
`semanticdb-project-roots' to a directory you think of as the top of
some project. All databases in subdirectories are considered part of
that group. See `semanticdb-current-database-list' for details on
all options. I'll document this better via some references.
>1. Once a cache file is created, semantic maintains it by updating from
>changed buffers at exit. Does semantic also check file dates on cached
>files, so that files changed outside of emacs (say, from CVS) stay
>updated as well?
When reading a file from disk, it checks file size to for a change
though. Perhaps dates would be a better metric. If the file is
already in a buffer it will not check anything.
>2. In the semanticdb-find-nonterminal-by-* functions, is the DATABASES
>argument a list of file paths to cache files? Or are they database lisp
>objects?
It is a list of database objects. I'll make this more explicit in
the documentation.
In theory, more types of databases will be available in the future,
such as lisp objects that read out of compiled object files, or
some-such.
>3. In semanticdb-find-nonterminal-by-function, is the FUNCTION arg a
>string? or a semantic object?
It is a lisp symbol that represents a function, or an anonymous lambda
expression. For example:
(defun semanticdb-find-nonterminal-by-name
(name &optional databases search-parts search-includes diff-mode find-file-match)
"Find all occurances of nonterminals with name NAME in databases.
See `semanticdb-find-nonterminal-by-function' for details on DATABASES,
SEARCH-PARTS, SEARCH-INCLUDES, DIFF-MODE, and FIND-FILE-MATCH.
Return a list ((DB-TABLE . TOKEN) ...)."
(semanticdb-find-nonterminal-by-function
(lambda (stream sp si)
(semantic-find-nonterminal-by-name name stream sp si))
databases search-parts search-includes diff-mode find-file-match))
>4. Finally, I'm having trouble dealing with the return objects of
>semanticdb-find-nonterminal functions, which seem often to be the entire
>cache, or at least the entire entry for a given file. What's the overall
> approach recommended for locating the actual textual extent of a tag
>definition, using these functions?
[ ... ]
The format of the return is:
( TABLEHIT1 TABLEHIT2 ... )
where TABLEHIT is of the form
( TABLE-OBJECT HIT1 HIT2 ... )
The objects are references, but if you look at the print form, it does
indeed look like the entire database (because it is.) You need these
objects to find the file the HITS are in. If you don't care about the
file the hits are from, you can use code like this on the return
value:
(apply #'append (mapcar #'cdr MATCHES))
to get something simpler.
If you get something working with cache files and CVS (which is what
it looks like from your message) let me know how it goes.
Have fun
Eric
--
Eric Ludlam: zappo@..., eric@...
Home: http://www.ultranet.com/~zappo Siege: http://www.siege-engine.com
Emacs: http://cedet.sourceforge.net GNU: http://www.gnu.org
|