Question

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.

Was it helpful?

Solution 2

Have you tried ac-source-gtags that is comes together with auto-complete package? You can also combine several sources, like described in documentation...

OTHER TIPS

Using clang+automplete is also an option:

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

Edit: I see you've edited the question indicating you have no clang. I leave this answer here regardless, in case someone else finds it useful.

I have found that cedet is really underwhelming. I would recommend using just one tool which does everything https://github.com/Andersbakken/rtags It underlines errors as you type as well as using smart completions. Just add this to your init file after obtaining the required emacs packages

(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)
)))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top