Tags

,

This post outlines how to create an “Edit with Emacs” context menu item in the Windows Shell for all files.

We will add registry keys so that when the “Edit with Emacs” menu option  is clicked, the file(s) selected will be opened in emacs using emacsclient. This just means that if there is a running emacs session, the file will be opened there. Otherwise if no emacs session exists, a new emacs session will be started.

Before getting started it might be worth reviewing the emacsclient documentation.

Okay then, to begin ensure that the line:

(server-start)

is in your emacs initialization file. Then restart your emacs session.

Next run regedit so that we can add registry keys to create a new “Edit with Emacs” menu option and associate an appropriate command with it.

Add the following keys:

[HKEY_CLASSES_ROOT\*\shell\Emacs] @="Edit with Emacs"

[HKEY_CLASSES_ROOT\*\shell\Emacs\command] @="c:\Program Files (x86)\emacs-23.2\bin\emacsclientw.exe" --no-wait --alternate-editor="c:/Program Files (x86)/emacs-23.2/bin/runemacs.exe" "%1"

Adjust paths as needed so that things match your environment. Mind the quotes though, as they should definitely be included when paths have spaces.

If everything worked you should be up and running.

Advertisements