1

This question already has an answer here:

I have not used EMACS seriously in 20 years.

I work on a Mac and am a vi/Eclipse person now.

I want to switch back to EMACS for C and C++ programming.

When I was researching EMACS add-on packages for C and C++ programming I quickly stumbled onto some good resources:

  1. https://www.emacswiki.org/emacs/CProgrammingLanguage
  2. https://tuhdo.github.io/c-ide.html
  3. http://cedet.sourceforge.net

However after several hours of tinkering I was left pretty much where I started.

What I was looking for was:

  1. A light weight configuration
  2. Syntax highlighting
  3. Make file editing
  4. Compilation and integration with the error and warning output form EMACS
  5. Execution without have to switch to a terminal
  6. A basic interface to GDB or LLDB
  7. Syntax completion would be a good extra

Any thoughts on where I can start this journey?

marked as duplicate by Tyler, Drew, Dan Dec 19 '17 at 0:54

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    You're asking 7 different questions, which is hard to deal with in this context. For #1, by default, Emacs comes with the lightest possible configuration - none. That's not a bad place to start. If you add features one at a time to that you'll understand what you've done better than if you just adopt someone else's multi-file setup. – Tyler Dec 18 '17 at 22:28
  • @Tyler, I'm actually doing that just using EMACS out of the box -- (for some reason) I seem to be making progress at a much slower pace than I'm typically used to. I spent a good after noon wrestling with CEDET and I was left with the impression that CEDET is either buggy, out of support or a tool that requires a lot more EMACS familiarity that I have. – user1172468 Dec 19 '17 at 1:19
  • @Tyler -- for example a map -- or perhaps 10 bullet points on where to proceed from vanilla EMACS I think would be helpful. Thanks – user1172468 Dec 19 '17 at 1:20
  • 1
    FYI: CEDET has been in a sort of limbo between being developed in Emacs repo vs its own repo for several years now Bug#23792. So yeah, probably buggy. – npostavs Dec 19 '17 at 1:54
2

If your project uses cmake, cmake-ide is a good start.

Or else, use company(auto completion)+counsel-gtags(code navigation)+global

You can use helm-gtags instead of counsel-gtags. Both packages are developed by the same person. The difference is they are based on different completion frameworks (helm vs counsel/ivy). I think counsel/ivy is faster and more robust than helm. So I prefer counsel-gtags.

This is the easiest solution for C++ IDE.

You can see http://blog.binchen.org/posts/emacs-as-c-ide-easy-way.html for more advanced use cases.

BTW,

  • I'm the developer of cpputils-cmake which is the first pure elisp package to setup Emacs C++ as IDE using cmake. It's still solid and usable but has less features than cmake-ide because I can't find any C++ jobs in Sydney for many years

  • I suggested Syohei YOSHIDA to develop counsel-gtags (https://github.com/syohex/emacs-helm-gtags/issues/153) because I don't like bugs in ggtags and helm.

  • I fixed the company issue so it can complete code across multiple directories (https://github.com/company-mode/company-mode/issues/570)

  • For debugger, the builtin GUD is good enough for me. But many people are using RealGUD these days

  • Other requirements you mentioned should be already supported by Emacs out of box. For example, you can M-x compile to run Makefile (https://www.emacswiki.org/emacs/CompileCommand)

0

tomorrow, I will put my own emacs configuration on github. It tries to emulate Atom in some places and its geared towards c/c++ development. Hope it will satisfy your needs.

Will edit this post with link when done.

  • any luck with your GitHub checkin -- looking forward to it – user1172468 Dec 19 '17 at 22:58

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