Using Emacs as an External Editor
What this tutorial is about
This short tutorial aims to walk you step by step through defining Emacs as an external editor for PhpStorm.
Basics of Emacs are out of scope of this tutorial.
Make sure that:
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 (on Windows and *nix) or (on macOS), or click 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...
- 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 Editors. This step is optional - if you specify no group name, then Emacs will appear in the menu as is.menu. In this example, the group name is
Clear the checkbox 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
Apply changes and close the Settings/Preferences dialog.
Opening current file in Emacs
When you now look at themenu, you will see the new node . Pointing to this node reveals the command:
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, PhpStorm 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 from the context menu:
Keyboard Shortcut dialog 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 themenu: