Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Emacs as an IDE

People also ask

Is Emacs obsolete?

Vim and Emacs aren't going anywhere anytime soon, no matter their antiquated status in modern development environments. IDEs will keep improving, keep launching, and serve an ever-growing segment of young developers who were never forced to thrive in Vim or Emacs environments.

Is Emacs better than VSCode?

VSCode is better than Emacs in lots of aspects, but I cannot leave Emacs for now because Org Mode in Emacs is just too powerful. Although VSCode also has an Org Mode addon, it only has some basic functionalities and hasn't been updated for ages.

Can you use Emacs for everything?

Emacs helps you be productive by providing an integrated environment for many different kinds of tasks: All of the basic editing commands (and there are lots of them) are available no matter what you're trying to do: write code, read a manual, use a shell, or compose an email.

Is Emacs better than Vim?

Emacs tends to be relatively straightforward, similar to commonly used text editors like Notepad. On the other hand, Vim is a power-user's tool, using keyboard shortcuts to speed up tasks. Vim is known to have a much steeper learning curve than Emacs.


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:

  • Looking up manpages, info manuals, and Elisp documentation from within emacs
  • Looking up Python documentation from within Emacs.

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.


I have to recommend Emacs Code Browser as a more "traditional" IDE style environment for emacs.

EDIT: I also now recommend Magit highly over the standard VCS interface in emacs.


Instead of running a make command in the shell window, have you tried M-x compile? It will run your make command, display errors, and in many cases make it very easy to jump to the line of code that caused the error if the output includes filenames and line numbers.

If you're a fan of IDEs, you might also want to look at emacs' speedbar package (M-x speedbar). And, if you haven't already, learn about how to use tags tables to navigate your code.


There are corners of emacs that once discovered make you more productive in ways you never thought of. As others have mentioned, using tags is a fantastic and fast way to zoom around your source code and using M-/ (dabbrev-expand) often does exactly what you expect when completing a variable name.

Using occur is useful to get a buffer with all occurences of a regular expression in a buffer. That's really handy when refactoring code and looking for fragments of code or uses of variables, or if you use TODO markers in your source files and you want to visit them all.

flush-lines, sort-numeric-fields, replace-regexp and rectangle functions can be really useful for taking a dump from some tool and converting it to useful data such as an elisp program or a comma delimited spreadsheet.

I wrote a page about IDE like things you can do with emacs

http://justinsboringpage.blogspot.com/2007/09/11-visual-studio-tricks-in-emacs.html

Learning elisp is a another great way to answer for yourself what else emacs can do beyond what a typical IDE can do.

For example I've blogged about writing Perforce helper functions like blame (writing your own means you can make it behave exactly as you want)...

http://justinsboringpage.blogspot.com/2009/01/who-changed-line-your-working-on-last.html

I've also written code that dynamically creates comments for a function at point, that matches the coding standards I'm working with.

None of my elisp code is particularly great, and most of it exists already in libraries, but it's really useful to be able to make emacs do custom stuff that just comes up during a working day.