Skip to end of metadata
Go to start of metadata

What this tutorial is about

This short tutorial aimd to walk you step by step through defining Emacs as an external editor for PyCharm.

What this tutorial is not about

Basics of Emacs are out of scope of this tutorial.

Before you start

Make sure that:

  • You are working with PyCharm 2.7 or later.
  • You have Emacs 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 PyCharm→Preferences (on Mac OS), or click button on the main toolbar.

Then, under the IDE settings, 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...

First, in the External tools page, click . The Create/Edit tool dialog box opens.

Here, 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.
  • Unselect 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.

Then 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:

Now, open a file in the PyCharm editor. Then, on the Tools menu, choose Editors→Emacs - and see the current file in Emacs also:

Assigning a keyboard shortcut

By the way, you can assign a keyboard shortcut to this action: click to open settings, open the Keymap page, in the list of actions find the node External Tools, expand the node Editors, right-click the nested node Emacs, and then choose Add keyboard shortcut command on the context menu:

Enter keyboard shortcut 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+Alt+Shift+E:

No conflicts are reported, so click OK, and see the new shortcut appearing in the list of actions:

Summary

What has been done here?

  • You've configured Emacs as an external editor.
  • You've opened a current file in Emacs from within PyCharm.
  • You've bound a keyboard shortcut to the new action.
Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.