deMaccs · 2022-11-09 11:16
OK, so here's my setup:
I run Windows Emacs and do most of my work there.
On some occasions I need to run Cygwin and do some stuff there.
What I'd like to do when in Cygwin is to edit a file in my running Windows Emacs.
I tried calling emacsclientw.exe from the Cygwin shell and pass a Windows file path but I always end up with a new instance of Emacs.
Is that something that I can get to work?
Cheers!
eli-zaretskii · 2022-11-09 14:36
If you use Cygwin, my suggestion is to use a Cygwin build of Emacs, not a native Windows build. That way, you will avoid problems due to subtle incompatibilities between Cygwin programs and native Windows programs.
jMilton13 · 2022-11-09 17:53
Hi Eli, does that also go for those who use mingw-w64? I have directed my Windows emacs to use that as a source for my grep program, find program, etc. Thanks for all you do!
ruscaire · 2022-11-09 19:23
Correct me if I’m wrong but isn’t emacsclient just a stub that signals to the main emacs to spawn a new frame? I guess in the case of cygwin it’s linked to the cygwin binary.
I think in fact isn’t there a pipe file that’s used to convey this signal? Native windows can only use a TCP port if memory serves so thr Cygwin emacs client could be using the pipe and finding it unconnected. There is a —server-file parameter you might be able to use to specify the windows port.
eli-zaretskii · 2022-11-10 08:35
If you use MinGW programs, the native Emacs is a better match. But whenever you add Cygwin to this mix, you should expect trouble, if you want to still use the same Emacs session for both.
If the only problem is that you get a new instance of Emacs, you need to invoke emacsclient with the `--server-file=server` option, so it uses a TCP socket for connecting to the server. Or set the `EMACS_SERVER_FILE` variable in the environment to point to the server file.
deMaccs · 2022-11-11 12:14
Always nice to answer your own questions :/
/drives/c/dev/emacs/bin/emacsclient.exe --server-file=\`cygpath -w \\ /drives/c/Users/myself/.emacs.d/server/server\` \`cygpath -w \\/home/mobaxterm/.viminfo\\\`
seems to do the trick.
​
Thanks to Eli. --server-file=server was necessary.