Thank you for your reply.

I will go to wiki and  look for the completion-ui.

And my reason to use gnu global is because I want to complete a function which is never declared in the current file. It seems do not allow in C++ program but sometimes will happen in C program.

在2008-12-04,bread <> 写道:

Plz check the inline comments. :)

On Thu, Dec 4, 2008 at 12:46 AM, yupeng82921 <> wrote:

I have two questions about semantic smart completion.

1. When I call "semantic-ia-complete-symbol-menu", it will show a pop up menu. But unless I select an option form it, the menu will not disappear. In fact, I want to find a function, when I call it, it can show a pop up menu, and I can select a symbol to comple, but if I do not want to select anyone, I can still insert character to the current buffer. If there is a function like this, I can bind it to every key on my keyboard, so whenever I insert a character, I can always get a completion menu. Is there a function let me do this?

If you do not wanna do anything after poping up the completion menu, just 'C-g' will help you to close it and continue your typing.

Speak of the completion menu, maybe you can try completion-ui or company-mode, both of which can be found on Emacs wiki.

2. It seems that semantic can only analyze the current file and its head file. If I want to write a function that never be declared in the current file, semantic can not comple it. But gnu global can do this. So I want to add global's completion result to the semantic pop up menu, could you tell me how could I do that? Additionally, maybe there are some redundance between semantic and global, I also want to re-arrange the completion result, could you tell me how to do that? Or is there other simple method?

Actually,  as what i think, semantic is much more intelligent than only analyzing current buffer and its head file. From my experience on semantic, at least, several files below can be analyzed.

1. system lib, such as standard library. In the latest version of CEDET(from CVS), the header files of standard library will be analyzed by default, you even need not write this in your configuration file:
(semantic-add-system-include "/usr/include/" 'c++-mode)

2. the head files in the same directory can be found automatically. For example, you write a main.cpp including a.h, where a.h includes b.h, where b.h .....

As long as they are stored in the same directory, all the header files can be found by semantic when you typing in main.cpp and try to get completions.

3. If you need another lib, let's say boost as an example. Since you can't put your codes in the same directory as boost, you can do this to teach semantic to analyze boost library and provide you completions whenever you want.

(semantic-add-system-include "WHERE_YOUR_BOOST_IS" 'c++-mode)

To be honest, there's also one thing for me that i'm confused, as long as i can see, i'm sure of the 3 things above. But sometimes i found i can get the completions from a header file, which was neither in system lib, nor in semantic-add-sytem-include directory, and i didn't put it in the same directory as my cpp, either. I don't know why semantic can do so, maybe what i thought and wrote before is totally wrong, and i'm really eager to know what the semantic-analyze-mechanism is.



Zhiqiu Kong (孔直秋)

EDA Labs
Dept. Computer Science & Technology
Tsinghua University
P.R China

[广告] 重奖 悬赏kfc3v3 球衣