IntelliJ IDEA 2017.1 Help

Using Emacs as an External Editor

On this page:

What this tutorial is about

This short tutorial aims to walk you step by step through defining Emacs as an external editor for IntelliJ IDEA.

Basics of Emacs are out of scope of this tutorial.


Make sure that:

  • You are working with IntelliJ IDEA 10.0 or later. This tutorial is created with IntelliJ IDEA version 2016.1.
  • Emacs is downloaded and properly installed on your computer.

Configuring Emacs as an external tool

Open Settings/Preferences dialog. To do that, you can, for example, choose File | Settings (on Windows and *nix) or IntelliJ IDEA| Preferences (on Mac OS), or click /help/img/idea/2017.1/settings.png button on the main toolbar.

Then, under the Tools node, open the page External Tools. On this page, you have to specify your Emacs installation as an external editor for the current file. This is how it's done...

  1. First, in the External Tools page, click /help/img/idea/2017.1/new.png. The Create/Edit Tool dialog box opens.
  2. In this dialog, do the following:
    • Type the tool name (Emacs) and optional description (Open Emacs)
    • Specify the name of the group, under which Emacs will appear in the Tools menu. In this example, the group name is Editors. This step is optional - if you specify no group name, then Emacs will appear in the Tools menu as is.
    • Clear the check box Open console.
    • Specify Emacs binary file location. You can either type it manually, or click the ellipsis button and find the desired binary in your file system.
    • Since you want to open the current file in Emacs, pass the file path as a parameter to the program: in the Parameters field, type $FilePath$.
    • Finally, specify the working directory - in our example, this is $ProjectFileDir$
    • Click OK.
  3. Apply changes and close the Settings/Preferences dialog.

Opening current file in Emacs

When you now look at the Tools menu, you will see the new node Editors. Pointing to this node reveals the Emacs command:


Open a file for editing. Next, on the Tools menu, choose Editors|Emacs - and see the current file in Emacs also:


Assigning a keyboard shortcut

By the way, IntelliJ IDEA makes it possible to assign a keyboard shortcut to this action: click /help/img/idea/2017.1/settings.png to open Settings/Preferences dialog, open the Keymap page, find Emacs, and choose Add Keyboard Shortcut on the context menu:


Enter Keyboard Shortcut Dialog dialog box opens, where you have to specify, which shortcut you would like this action to be associated with. Let’s, for example, use Ctrl+Shift+Alt+E:


No conflicts are reported, so click OK, and see the new shortcut appearing in the list of actions and on the Tools | Editors | Emacs menu:


See Also

Last modified: 18 July 2017