Emacs: What's the Best Setup for Coding {Python, Java, C++, Web Dev, …}?

By Xah Lee. Date: . Last updated: .

One of the common question i get is:

what's the best emacs setup for {Python, Ruby, PHP, JavaScript, Java, C++, …}?

Vanilla Emacs works fine. You just need to master it.

For me, i avoid using any external packages. If i need something, emacs features does it, or i write some elisp, or i write my own mode.

• for setting up emacs User Interface, here's some collection of how-to: How to Set Emacs's User Interface.

• I recommend you master {emacs help system, buffer switching, dired, search, find/replace, regex, setting emacs keys}. It sounds a lot, but actually not too hard. See this guide to get going: Tips on Long Term Emacs Productivity.

Completion and Templates

• completion and templates are extremely useful. This is the most frequently asked question. Again, emacs has many packages for this, but they are not all coherent. You just have to try each out. Also, note that if you are {C, C++, Java} programer working on large code base, emacs's completion will never be as good as those in Microsoft Visual Studio or IntelliJ (or the lesser Eclispe, NetBeans).

for completion, templates, tags, there's auto-complete, yasnippet, …, see: Emacs: Name Completion Features and Packages. Yes, i use all of them.

I've heard good things for GNU GLOBAL (aka gtags). http://www.gnu.org/software/global/ (i've not tried it)

Completion system for Java development, check out:

List of Emacs Starter Kits

List of Emacs Starter Kits

Setting Up Emacs for C, Python, Ruby, Web Dev

• for “best” setup for {C, Python, JavaScript, Java, …}, there isn't one universal answer. But you can try prepared package sets. The most popular are “Emacs Starter Kit” and “emacs prelude”, and there few others. The starter kit and prelude are both in MELPA package repository, so you can experiment with them easily. See: Emacs: How to Install Packages Using ELPA, MELPA.

There are also pre-build emacs with bundled packages and setup done for you. For example, some focus on LaTeX. You can have a look at Download Emacs for Windows, Mac, Linux.

• There's “flymake-mode” at http://flymake.sourceforge.net/. It's a on-the-fly syntax check tool using the external syntax check tool. Originally for C/C++, but people have created packages for {Python, Ruby, …}.

C, C++

Emacs for C++ developers By Bin Chen (陈斌). At https://github.com/redguardtoo/mastering-emacs-in-one-year-guide/blob/master/emacs_cpp_developer_guide-en.org


• for Python, i've heard good things about:

Elpy, the Emacs Lisp Python Environment https://github.com/jorgenschaefer/elpy/wiki

Jedi.el — Python auto-completion for Emacs http://tkf.github.io/emacs-jedi/

Ropemacs is a plugin for performing python refactorings in emacs. It uses rope library and pymacs. http://rope.sourceforge.net/ropemacs.html


for Ruby dev, see:


I've heard good things about “web-mode” at http://web-mode.org/. It's on MELPA.

emacs lisp

• for coding emacs lisp, you might try my mode Emacs: Xah Emacs Lisp Mode, which features full coloring.

Emacs is a system for elisp, there are lots of builtin features. See:

One popular recommendation among lisp hackers is ParEdit. It's a bit complex and require learning.

• for managing emacs init file, i recommend just quick split into files. Organize Emacs Init File in 5 Minutes.

The more experience you have with emacs, the less likely you'll need to look for that one “best” package.

check out tips from reddit comments. http://www.reddit.com/r/emacs/comments/1j3ds6/whats_the_best_emacs_setup_for_coding_pyhton_java/

Like it? Buy Xah Emacs Tutorial. Thanks.