Using Emacs as an IDE

user7545 picture user7545 · Sep 15, 2008 · Viewed 71.4k times · Source

Currently my workflow with Emacs when I am coding in C or C++ involves three windows. The largest on the right contains the file I am working with. The left is split into two, the bottom being a shell which I use to type in compile or make commands, and the top is often some sort of documentation or README file that I want to consult while I am working. Now I know there are some pretty expert Emacs users out there, and I am curious what other Emacs functionally is useful if the intention is to use it as a complete IDE. Specifically, most IDEs usually fulfill these functions is some form or another:

  • Source code editor
  • Compiler
  • Debugging
  • Documentation Lookup
  • Version Control
  • OO features like class lookup and object inspector

For a few of these, it's pretty obvious how Emacs can fit these functions, but what about the rest? Also, if a specific language must be focused on, I'd say it should be C++.

Edit: One user pointed out that I should have been more specific when I said 'what about the rest'. Mostly I was curious about efficient version control, as well as documentation lookup. For example, in SLIME it is fairly easy to do a quick hyperspec lookup on a Lisp function. Is there a quick way to look up something in C++ STL documentation (if I forgot the exact syntax of hash_map, for example)?

Answer

Ben Collins picture Ben Collins · Sep 15, 2008

You'll have to be specific as to what you mean by "the rest". Except for the object inspector (that I"m aware of), emacs does all the above quite easily:

  • editor (obvious)
  • compiler - just run M-x compile and enter your compile command. From there on, you can just M-x compile and use the default. Emacs will capture C/C++ compiler errors (works best with GCC) and help you navigate to lines with warnings or errors.
  • Debugging - similarly, when you want to debug, type M-x gdb and it will create a gdb buffer with special bindings
  • Documentation Lookup - emacs has excellent CScope bindings for code navigation. For other documentation: Emacs also has a manpage reader, and for everything else, there's the web and books.
  • version control - there are lots of Emacs bindings for various VCS backends (CVS, SCCS, RCS, SVN, GIT all come to mind)

Edit: I realize my answer about documentation lookup really pertained to code navigation. Here's some more to-the-point info:

Google searching will no doubt reveal further examples.

As the second link shows, looking up functions (and whatever) in other documentation can be done, even if not supported out of the box.