Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: Why would you prefer Emacs over IntelliJ IDEA?
15 points by anildigital on March 15, 2015 | hide | past | favorite | 20 comments



(note: everything here is scoped to the Java/JVM ecosystem.)

Not to flamebait, but as someone who has worked extensively with large Java / Clojure projects, the only reasons you would use Emacs are

- when working with a toy project (only one module, no complex dependencies or scoping

- intertia (or less kindly, stubbornness)

- ignorance

I have nothing against command line tools. As a linux user, I use Vim whenever possible and it makes sense. But when you are using a large modern Java application, especially one built on a framework (ex Hadoop) with a complex dependency chain and command line classpath manipulation, you are going to go insane trying to manage everything in Emacs. Intellij gives you many huge tools

- JUnit integration and debugging. I don't know if Emacs in theory supports this, but I am sure no plugin will correctly parse dependency chains and let you debug a test well

- Finding references and usages. You can find all usages of a method or class across an entire codebase with a few keyboard shortcuts in Intellij. This is hugely valuable when figuring out what teams are impacted by changes. Grepping for usage simply does not cut it (grep for .get()? hah.)

- Safe refactoring. Want to rename a method? Just refactor it, and everything will compile afterwards, including all usages, and if you want, all superclasses or interfaces which define the method. Incredible.

- Style and safety warnings. The method recurses infinitely? You're getting the wrong type out of the map? A local variable is unused? Intellij will do them all. Not a chance, unless your IDE is integrated with a real compiler.

I could spend all day filling in this list, but you get the idea. You can waste time playing around writing Java in Emacs, but at the end of the day my goal is getting real work done.


Java is one of the langauges emacs has the weakest support for. It really depends on the language.

Emacs is has great C# support with navigation, refactoring, auto-completion (the real thing, not a text match), etc. Combine that with the various helm methods of grepping, helm-cmd-t, and helm-git-grep. Emacs is better than Visual Studio at C#, but you do need to dive down the rabbit hole to really use it well. Emacs blows IntelliJ out of the water when it comes to C#.

First class Java support is possible, but most hard core emacs users could care less about Java.

If you use lisp you get SLIME. Your unit tests are macros, with first class support as any other part of the language. And whatever shenanigans you can dream up will be supported as a first class part of the language, that would require vendor support in IntelliJ.


>First class Java support is possible, but most hard core emacs users could care less about Java.

This is surprising to learn considering the two languages are similar in so many ways. Why is this the case?


Emacs works everywhere (windows, linux, mac, etc). It is not specific to any language so I can use it for many projects. It works on remote systems as well as local systems. It has decades of extensions (rmail, slime, org mode, etc). It works for HUGE files, can follow compiler errors, does xref lookups, make a shell unbelievable useful, and is very productive. On some days it seems that at least half of my productivity is due to emacs, especially due to keystroke macros. The only valid complaint I ever heard about emacs was that it is a great operating system which could use a good editor.

On the other hand things like IDEs try to hide everything. You don't know what the build system actually does. You don't know how "resource files" get attached. You are presented with a bunch of menus which focus your attention and skills toward a "standard" style. The Java IDEs are not as bad as the XCode IDE (proprietary files?) but they still hide information.

Your tools shape how you think and what you can think. Emacs is "just there" waiting for your commands. IDEs limit your thoughts and hide things from your understanding.

As a programmer, I need to know how my code calls the operating system, how the operating system runs the hardware, how the hardware fetches and caches, how the bits get turned into voltages, and how the voltages affect the world. Emacs is just a logical extension of the same philosophy.


I work in emacs mostly, but have given IDEA (and its varients like PyCharm) a fair shot on several occasions. I keep coming back to emacs. Why, well, in no particular order:

- extensibility, if I don't like something in emacs I can always change it, less so in IDEA.

- IDEA has problems with key shortcuts on the dvorak (and other non-querty) keyboard layout, and the devs have no intention of fixing them.

- plugins. In my experience, language-specific plugins in IDEA tend to either suck or not work so well. Emacs, by comparison has support for damn-near any language, and many of those packages include tasty features which make working in each language a joy. (see the various lisp modes, ensime, and so forth)

- speed, IDEA is slow, too slow.

- IDEA is too "mouse driven" for my liking. In emacs, absolutely everything can be controlled via keyboard shortcuts, less so with IDEA.

- emacs runs in a terminal as well as a gui.

- emacs has awesome productivity boosting packages like helm, god-mode, projectile and org-mode, which don't have equivalents in IDEA.

- With emacs I can mold the tool to fit my hand. When I use IDEA, it feels the opposite, like I'm having to change my hand to fit the tool and its way of doing things.

- ultimately, I don't think an IDE actually brings much to the table. I don't get any value from having the project build tied to a green triangle graphic, and I generally find the usual IDE workflow to be slow and clumsy. Emacs works perfectly, it does exactly what I ask of it and then gets out of the way.


It seems that you've aren't aware of many useful IntelliJ features.

> extensibility, if I don't like something in emacs I can always change it, less so in IDEA.

IntelliJ has extensive plugin API.

> IDEA has problems with key shortcuts on the dvorak (and other non-querty) keyboard layout, and the devs have no intention of fixing them.

You can tune keymap for you. For example, I don't use default shortcuts.

> plugins. In my experience, language-specific plugins in IDEA tend to either suck or not work so well. Emacs, by comparison has support for damn-near any language, and many of those packages include tasty features which make working in each language a joy. (see the various lisp modes, ensime, and so forth)

In my experience, emacs works well only with basic language support. If you want something more advanced, for example, completion, error checking, you have much worse experience. In case of rarely used languages, for example, Idris, Agda, etc, they often just don't work.

> speed, IDEA is slow, too slow.

If you don't need smart features, you can turn them off, and IntelliJ will be at least as fast as emacs (google power save mode).

> IDEA is too "mouse driven" for my liking. In emacs, absolutely everything can be controlled via keyboard shortcuts, less so with IDEA.

It's definitely not mouse driven. AFAIK, everything can be done via keyboard.

> ultimately, I don't think an IDE actually brings much to the table. I don't get any value from having the project build tied to a green triangle graphic, and I generally find the usual IDE workflow to be slow and clumsy. Emacs works perfectly, it does exactly what I ask of it and then gets out of the way.

I look at IntelliJ not as IDE but as a code navigation/refactoring tool. I can work in emacs if I have about 10s of KLOC, but after this, I need an effective tool to navigate code.


Does company-mode completion not work for you?

> In case of rarely used languages, for example, Idris, Agda, etc, they often just don't work.

Really? My experience is that emacs had the only support for rarely used languages.

> It's definitely not mouse driven. AFAIK, everything can be done via keyboard.

What about selecting the android device to run an application on when you have multiple devices connected?


>Does company-mode completion not work for you?

What do you mean by this?

>Really? My experience is that emacs had the only support for rarely used languages.

In my experience, everything except syntax highlighting often doesn't work. But, anyway these are esoteric languages.

>What about selecting the android device to run an application on when you have multiple devices connected?

I don't use android, but you can create several run configurations, one for each device, and run them via shortcut. My configuration works like this: I set Ctrl+R to show popup menu with available options, then I type the name of the configuration and press enter.

Another action you probably aren't aware of is Navigate to action. It works in a way similar to M-x in emacs. See more here: https://www.jetbrains.com/idea/help/navigating-to-action.htm...


Side note: Esoteric languages aren't usually languages that follow the dictionary definition of esoteric. That is to say, being uncommonly used doesn't make something an "esoteric language". The term is usually reserved for intentionally strange languages like Brainfuck, Whitespace, Shakespeare, etc.

Idris and Agda are serious languages built to do really amazing things. They're both still pretty young, but have incredible potential.


(1) I ssh and use the terminal based emacs more than just about anything else.

(2) Macros are awesome, though I'm sure you can set up IntelliJ to use this as well.

(3) I wrote some eLisp to make my life easier, that's the really big advantage to Emacs over most alternatives.


- Works in the terminal

- org mode

- has a lot of maturity and innumerable useful extensins/plugins/whatever-we-may-choose-to-call-them

- can be quite lightweight if desired


Do you think that org-mode could be extracted into its own application, or is it too bound to emacs? As a die-hard vim-user-turned-intellij-user (mostly because intellij has the best vim keybindings I've seen), org-mode is the thing about emacs that fascinates me the most.


The problem with extracting org-mode into its own application is that a lot of the magic of org-mode comes from emacs. It's not so much being tied up in emacs as sharing and extending the design. By moving org-mode elsewhere, you'd reinvent the wheel and put an artificial division where there doesn't need to be one.

For example, org-babel allows you easy access to any language you have support for in emacs. Same syntax highlighting, same behaviour, same utilities. Improve any of that and org-mode takes advantage of it for basically zero cost.


I bet evil's vim keybindings are better, at least they are the best I've seen.


I routinely program in Python, C, and Haskell, and write prose in Markdown, reST, and LaTeX. I also sometimes use emacs modes for other languages, like QML, YAML, and GLSL. It is very convenient to have a unified interface when using those different languages. This means the only context switching I have to do with different projects is directly related to the language or project itself, not with how to use the different IDE (especially if you haven't touched a project or language in a while). I even have auto-complete setup for the three programming languages.

Another killer feature of emacs is org-mode. With it, I organize all of my tasks for work and my personal life, and create outlines that I can easily export to pdf to send to others. Every org file is just plain text, so you can have all of your notes saved forever as long as you can read ASCII text :) Honestly, org-mode was the original reason I decided to learn emacs; it really is that neat.

I can't and won't try to make an argument about how emacs is objectively superior to certain IDEs for certain tasks. Really, you just have to have an interest in learning it, and hopefully you can increase your productivity with it. I thought learning emacs was fun, and I am always grateful that I can modify my text editor however I like.


I've used IntelliJ IDEA on Ubuntu for years and I can't remember it being actually stable at any point in time. There's always been known issues where its freezing, crashing, sometimes requiring complete re-installs. I didn't like the experience of dealing with their support. They'd tersely request me to perform tasks to help them debug (don't have the time to help them debug a commercial product), and they would blame their dependencies stating that those dependencies have known issues on my OS. Their stuff is very stable on mac, but not on Ubuntu. I still put up with the random bugs because its pretty decent overall.


I've flirted with IDEs over the years but I've stuck with a combination of Emacs, Terminator, and various commandline tools like bpython.

Here are some reasons I've seen for using IDEs:

- Autocomplete, syntax highlighting: Emacs has autocomplete and syntax highlighting (there are many themes in Emacs). bpython (an enhanced Python REPL) also has these.

- Code navigation: Emacs has a lot of nifty keys for zipping around within a document and with iswitchb navigating between documents is really fast. Some of the IDEs offer "goto" functions that will take you directly to where a function is defined, which would be nice.

- Code discovery: bpython displays function documentation and args; with autocomplete these are really quick. Granted, they're not displayed whenever my cursor hits a function so an IDE would be convenient if you use this all the time.

- Integrated console, debugger, and VCS: With Terminator I usually have a tab for each project, split into panes for console, logs, etc, etc. They're not displayed in the same window as my code but flipping between Emacs and Terminator is trivial.

- Refactoring support: Emacs has python-rope mode but it's a bit clumsy. This is one area where an IDE is probably better.

With my setup I have the keystrokes for the original tools (git, pdb, etc, etc.) under my fingers. I have to use these tools outside of the IDE anyway so this way I only have to learn one set of keystrokes.

My Emacs configs live in a Git repo and I can install them wherever Emacs is installed and I have a user directory.

I run Emacs and Terminator on my desktop and edit code directly on VMs and remote systems via ssh[1]. This keeps my desktop free from cruft and lets me develop in a setup that's close to my production setup. IDEs all seem to require that the code be on the same system as the IDE. Maybe they can but the ability wasn't obvious or well documented and I confess I didn't spend much time looking.

I do mostly back-end web programming and system administration. IDEs certainly have their place, and might be more useful if I was developing desktop applications, iPhone apps, or coding for microcontrollers.

[1] ssh/tramp can cause lockups due to network issues but these settings in my .emacs file work nicely:

  ; tramp - edit over ssh
  ; open remote files with /username@host:remote_path
  (require 'tramp)
  (setq tramp-default-method "scp")
  (setq password-cache-expiry 3600) ; password cache - 60 * 60
Updated for clarity, and to add tramp config.


I wouldn't. I use IntelliJ for almost all the stuff I code, thanks to the support for almost any languages which you can find via plugins.


100% control and it works in the terminal.


I use Idea for Scala and Emacs for everything else. I prefer Emacs for the following reasons:

* I find Idea to be very cumbersome. I can perform many powerful transformations on text in Emacs with just a few keystrokes. Idea respects virtually none of them, even in Emacs mode. I often have to copy/paste from Idea into Emacs, make changes, then copy/paste back into Idea.

* Idea is hopelessly mouse driven. Most of the functionality can't be triggered via the keyboard.

* Emacs has a much smaller system footprint. Idea usually eats up a few gigs of RAM. I understand that it's trying to do a lot of stuff to help out, but I feel like it really needs to be optimized.

* I can mix and match minor modes. I don't usually care about spellchecking my code, but it's a few keystrokes away in any given buffer. In Idea I'm always getting warnings about misspellings, even though I don't care. I have a minor mode for line wrapping, showing whitespace, finding stop-points mid-word in camel-case/snake-case text, and innumerable other things. I can turn them on globally, or in a single buffer.

* Macros are wonderful in Emacs. They can do anything I can do with the keyboard, which is everything. I can even have a macro that uses Magit to find changed files in my project, find each occurrence of a given regex in those changed files, copy each of the containing lines into an Org mode document, and prettily format them. It takes about 20 seconds to build that macro.

* Emacs has thousands and thousands of great extensions. Idea has a fair number, but not nearly as many.

* Many of the languages I care about (Haskell, Idris, Agda, etc.) are either supported better in Emacs, or are ONLY supported in Emacs. LiquidHaskell is amazing, but I don't believe there's any support in Idea.

* I don't generally care about the sorts of IDE things that Idea does. Intelligent autocomplete doesn't appeal to me. Many languages (like Ruby, JaveScript, and Python) make it literally impossible to intelligently autocomplete with 100% accuracy. Much like with documentation, I'd prefer not have intelligent autocomplete at all rather than lying intelligent autocomplete.

* I can embed a terminal as a buffer. I know Idea has a terminal, but it treats it as a special window, and I can only have one without a terminal multiplexer. In Emacs it's just a major mode, so I can have as many as I want, and I can treat them like any other buffer. I can even use my familiar Emacs commands and minor modes on them.

That's a lot of bad stuff, but one thing that Idea gets right is that getting set up for JVM languages is easier. I keep meaning to get around to setting up proper Scala support in Emacs, but I never seem to find the couple of hours it would take. Idea has reasonable support for it out of the box.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: