Starting Emacs from IntelliJ IDEA
Posted on 2016-06-18 Edit on GitHub
I'm a big Emacs user, but Emacs is still not up to par with "real IDEs" when it comes to doing project configuration, code analysis, refactoring, etc., which take up much more time than text editing.
This is especially true for large and complex languages like Java. There are a few traits that make Java particularly difficult to support by editors like Emacs:
- Projects contain lots of files that are not Java source code
- Standard libraries are large and complex
- Third-party libraries are numerous
- The syntax is verbose and complex
I use IntelliJ IDEA when writing Java. IntelliJ IDEA is a powerful IDE, with particularly good support for autocompletion and refactoring. This is important when writing Java, which, in my experience, is a particularly tedious and error-prone language for all the reasons listed above.
Sometimes, however, I really need the editing capabilities of Emacs. The IntelliJ IDEA Emacs bindings work fine most of the time, but being able to open a file directly in Emacs is a totally different animal.
As it turns out, doing so is not difficult. Ken Fox from Atomic Object has a great post on achieving this through an external command.
Long story short,
- Go to File > Settings > Tools > External Tools and create a new external tool.
- Make sure to check Synchronize files after execution and uncheck Open console.
- Fill in the following:
- OK out of the dialog.
The external tool can now be found under Tools > External Tools, but it would good to add a key binding for it.
- Go to File > Settings > Keymap
- Go to External Tools > External Tools > <tool-name>
- Hit Enter, and select Add keyboard shortcut
- Add a keyboard shortcut; I prefer
Ctrl-c e
.