2

I have setup Emacs to work almost like an IDE but I haven't managed to make it suggest the available methods of every class.

I currently write in C++ and previously I was using Visual Studio so when I was pressing the dot it would suggest to me the available methods.

As the methods most of the times are countless this is a very important feature for me but I have yet to find how to implement it.

I believe that this is a problem of every person writing code so I can only guess that there is surely a package for Emacs to offer this functionality. Can someone suggest any?

| improve this question | | | | |
3

CEDET is a complete package that is supposed to give Emacs IDE features comparable to Visual Studio or Eclipse. It has a reputation for being fairly complicated to set up, but there are a lot of tutorials on it in both web page and YouTube form: here's one that looks pretty easy to follow.

Alternatively, if all you want is auto-suggestion of member function names, I have heard irony-mode recommended highly. Combined with tags and Projectile you would have a much lighter-weight installation than CEDET with most of the key IDE functionality.

| improve this answer | | | | |
  • Your suggestion is interesting but as I read most sources say that it is outdated. It seems strange to me that a feature so common has not a more easy and up-to-date package. – Adam May 20 '15 at 18:12
3

For code completion, I suggest you to use irony-mode along with company-irony. You can easily get them from MELPA. When you finished installing, you have to build Irony server with M-x irony-install-server. You also have to add a .clang_complete file at the project root path with compile flags for including source header paths, so Irony can use that information to parse your files and provide the feature you are needing. If files are in the current directory, Irony can automatically recognize it.

My C/C++ guide my help you to do the following:

  • Find definitions in project, even as large as Linux kernel.
  • Find references in project.
  • Find any file in a using Projectile using Helm and Helm Projectile, as in this guide, even if your project has as many files as Linux kernel or more.
  • Completion system header with company-c-headers.
  • Source code information for current identifier at point that look like this:

semantic-idle-summary

stickyfunc-enhance

  • Small scale code refactoring with semantic-refactor. You can see all the demos here.

    • Context-sensitive menu offers appropriate refactoring actions

    • Generate class implementation (also handles nested class and class template)

    • Generate class getters and setters

    • Generate function implementation (also handles function template)

    • Generate function prototype

    • Convert function to function pointer

    • Convert function to function parameter

    • Move semantic units (class, function, variable)

    • Extract function with proper type information

    • Precise local variable rename

| improve this answer | | | | |
  • Thank you for the answer, although it is focused on code completion which I have already implemented. – Adam May 20 '15 at 18:10
  • So, which package did you choose? Irony or something else? – Tu Do May 20 '15 at 18:58
  • I chose auto-complete. When I installed it I didn't even know that irony existed. – Adam May 20 '15 at 19:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.