Using Emacs as an External Editor in PyCharm
On this page:
- What this tutorial is about
- Configuring Emacs as an external tool
- Opening current file in Emacs
- Assigning a keyboard shortcut
What this tutorial is about
This short tutorial aims to walk you step by step through defining Emacs as an external editor for PyCharm.
Basics of Emacs are out of scope of this tutorial.
Make sure that:
- You are working with PyCharm 2.7 or later. This tutorial is created with PyCharm version 5.O.x.
- Emacs is downloaded and properly installed on your computer.
Configuring Emacs as an external tool
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...
- First, in the External Tools page, click . The Create/Edit Tool dialog box opens.
- 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 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 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
- Finally, specify the working directory - in our example, this is
- Click OK.
- Apply changes and close the Settings/Preferences dialog.
Opening current file in Emacs
Open a file for editing. Next, on the menu, choose - and see the current file in Emacs also:
Assigning a keyboard shortcut
By the way, PyCharm makes it possible to assign a keyboard shortcut to this action: click to open Settings/Preferences dialog, open the Keymap page, find Emacs, and choose 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: