2

Hi I work on a very large and complex C code base (complex not in a good way). The codebase dwarfs the linux kernel to give you an idea. I have set up emacs to do most of what I want. I get autocompletion on functions and variables but there are certain things which do not work (omni-completion).

I use cedet v2, xgtags, auto-complete, yastnippet, cscope and a few other tools all of which are installed via el-get on emacs-24. When I work on a smaller project, omni-completion in C works so I would get a list of the members of a struct when I access the object. However, in the very large "project", omni-completion does not work when accessing a struct. As I said, I get completion on functions and variables but not on structures.

My explanation is that auto-completion is using its parser which cannot handle the size and complexity of the codebase. However, gtags or etags can handle it.

Is there a way to make auto-complete look into the gtags (xgtags) database? My gtags are working very well indeed.

EDIT: I am not an admin on my system and I cannot install packages easily. At the moment, I do not have clang. Having said that, I am quite capable of compiling from source and can get many packages this way.

4

3 回答 3

3

使用 clang+automplete 也是一个选项:

http://truongtx.me/2013/03/06/emacs-ccpp-autocomplete-with-clang/

编辑:我看到你已经编辑了表明你没有铿锵声的问题。无论如何,我将这个答案留在这里,以防其他人发现它有用。

于 2013-10-31T14:11:59.663 回答
2

您是否尝试过ac-source-gtagsauto-complete包装一起提供的?您还可以组合多个来源,如文档中所述...

于 2013-10-31T15:00:02.530 回答
0

我发现 cedet 真的很不起眼。我建议只使用一个工具来完成所有操作 https://github.com/Andersbakken/rtags 它会在您键入时强调错误以及使用智能完成。获取所需的 emacs 包后,只需将其添加到您的 init 文件中

(require 'rtags)
(require 'popup)
(require 'rtags-ac)
(setq rtags-completions-enabled t)
(rtags-enable-standard-keybindings c-mode-base-map)
(add-hook 'c++-mode-hook
          (lambda ()
            (setq ac-sources '(ac-source-rtags)
)))
于 2015-07-17T21:23:36.313 回答