Thomas Becker's Free Software Utilities

Devenv Emulation: Improved Compiling and Debugging (gcc and gdb Integration) in GNU Emacs

GNU Emacs supports integrated compiling and debugging. This brings with it such conveniences as jumping from a compiler error message directly to the offending location in the source code, and source-level debugging in Emacs buffers. Some people argue that turning an editor into a development environment like that is an ill-fated endeavour from the start; they hold that a development environment should be a stand-alone program of which the editor is an integrated component. Be that as it may, many of us, including myself, use GNU Emacs' compiling and debugging features.

Unfortunately, if you use GNU Emacs out of the box, compiling and debugging come with some annoyances. My personal pet peeves are:

  • In an integrated development environment such as Microsoft Visual Studio, the first thing you do is open a project (or "solution" in Microsoft speak). After that, tasks such as compiling an individual source file, building the whole thing, starting a debug session, etc. can be kicked off with function keys. One never has to to type a compile, make, or debug command anymore. For me, that does make a big difference in productivity.
  • Many compilers, including gcc, output error messages where the file location of the error is given as a relative path. That causes trouble in large projects, where source files are scattered over several directories. In that case, jumping from the error messages in the compilation output buffer to the respective locations in the source files via next-error (pressing Ctrl-x `) has a problem: depending on your setup, it can either work when compiling individual source files, or it can work when compiling the entire project, but not for both.
The Devenv Emulation package removes these annoyances and adds some minor conveniences. Among other things, it provides function key bindings that are modeled after Microsoft Visual Studio.

The online documentation of Devenv Emulation can be found here. To download the Devenv Emulation package including Emacs Lisp source code, the byte-compiled code, and the HTML documentation, click the link below.

Download Devenv Emulation for GNU Emacs