On 04/07/2010 09:32 AM, Tian Fang wrote:
> On Tue, Apr 6, 2010 at 10:11 PM, Eric M. Ludlam <eric@...
> <mailto:eric@...>> wrote:
> On 04/05/2010 10:14 AM, Tian Fang wrote:
> Is there a way to use GNU GLOBAL database pre-generated for
> In the following example, global DB is pre-generated, which
> includes the
> structure defined in a.h. Then, in b.c, w/o relying on the "include
> a.h", I can still use the global db to auto-complete structure
> defined in a.h.
> The Emacs code that comes with GNU Global can do completions w/out
> relying on which includes are in a given file. Semantic can also
> complete like that, but only on global symbols. It cannot do smart
> completion, and derive datatypes of variables to know they are
> structures, without relying on header files.
> [Tian] Glad to hear that Semantic can use only global for completion,
> even not a smart one. In this case, how should I config my .emacs? I
> already have the following two enabled. But still get "unknown type"
> error msg when doing sematic-ia-complete-symbol for a structure field.
> (semanticdb-enable-gnu-global-databases 'c-mode)
> (semanticdb-enable-gnu-global-databases 'c++-mode)
> If you have GNU Global, Semantic can look up some global symbols
> using it. That helps when you are starting in a fresh directory
> where Emacs hasn't had a chance to parse all your files yet.
There are two kinds of searches. There are searches that search an
entire 'project' for a symbol. That is when GNU Global will be used.
This kind of search isn't used very often.
There are also more narrowly defined searches, that will only pull in
the stuff you include. The smart completion system only uses the more
narrowly defined searches, so you need to have the structure in a header
that is included.
To make sure GNU Global is properly enabled, you can run the command:
to dump out the databases being used. Is GNU Global there, at the end
of the list?)
It may be that GNU Global doesn't know about the struct either for some
reason. I haven't tried you explicit example yet. I can give it a go,
but I'm not sure when.