If you want some, come to the Melbourne emacs meetup.
857 Burke Road
Friday April 26, 2013 6:00 PM
My business’s accounting program, which I’ll call Canopus, has issues. One of which is that it assumes wordpad.exe will be in c:\windows. As far as I know, Microsoft moved wordpad.exe’s default location away from c:\windows about 20 years ago. Canopus live in hope that it will be there so installing Canopus always requires one to copy wordpad.exe to c:\windows
The other problem with Canopus is that it does not fork when launching wordpad.exe, so you can’t continue using it until you close wordpad. This is stupid as most likely you need the information in wordpad to do further work in Canopus.
So a long time ago I came up with a solution. With the help of a friend (well, he wrote it for me in Delphi) I developed a small program called wordpad.exe which reads a config.ini file to configure which editor to open. It makes a copy of the file in
$1 and launches whatever editor you specify in the config.ini with
$1 as its parameter.
This worked well and everyone was happy until I decided to use cygwin emacs instead of the native win32 compiled emacs.
The problem is that cygwin emacs expects paths to be of the unix flavour (/home/jason/whatever) rather than the dos flavour (c:\users\jason\whatever). And so the rabbit hole needed and extension.
I didn’t want to have to modify my wordpad.exe program as that would require me to get the lazarus (open source delphi replacement) toolchain working again, so I decided to write a shell script wrapper to do it.
#!/bin/bash /usr/local/bin/emacsclient.exe -n $(cygpath "$1")
and my config.ini for wordpad.exe:
[Config] Exe=c:\cygwin\bin\run.exe option=/usr/bin/bash.exe "/cygdrive/c/Users/jason/launchemacs.sh"
You can see that wordpad.exe launches the cygwin run.exe which calls the launchemacs.sh file with the first parameter.