Open With Emacs
I have finally found a decent solution to use Emacs when interacting with the "Open with" context menu option on Windows.
Basic idea:
- Run Emacs in server-mode
- Use AutoHotkey to create a binary that either starts Emacs or connects to it
using
emacsclient
Steps:
- Create a new
.ahkscript based on the content below - Adapt the bin directory variable to your needs
- Use Ahk2Exe to turn the script into a binary
- Note: Make sure you select the correct base file (to support AutoHotkey v2 instead of v1)
- Copy the binary to a directory that is on
PATH(or add a new entry) - You can now choose your new binary as an "Open with" option when opening files
path := A_Args[1]
bin := "C:\ProgramData\Emacs\bin"
command := Format("{1}\emacsclientw.exe --no-wait --alternate-editor={1}\runemacs.exe {2}", bin, path)
Run command