1

I am using GNU Emacs for Windows alongside of cygwin, and I want to set my EDITOR shell variable to be emacsclient -a=. My problem is that when certain programs try to use EDITOR to launch an editor with some pre-populated text, like git commit, fc, or edit-and-execute-command from bash, the emacs client frame opens with an empty buffer. How do I get it to show the contents of the file that the program is trying to open?

Marty Neal
  • 199
  • 7

1 Answers1

1

The editor shows a blank buffer because it it trying to open a file with a cygwin styled path. e.g. /tmp/bash-fc.abcdef which in turn tries to open C:\tmp\bash-fc.abcdef which doesn't exist, so it opens a new file. The solution is to define a function which takes a path and uses cygpath to convert it to a windows path, and opens it with emacsclient. I have put this in my .bashrc and it seems to work.

function emacsclientWindowsPath() { emacsclient -a= -- $(cygpath -w $1); }
export EDITOR='emacsclientWindowsPath'
Marty Neal
  • 199
  • 7