TAGS :Viewed: 1 - Published at: a few seconds ago

[ Best place to hook path conversion in to Emacs under Windows ]

I use GNU Emacs on Windows with git-bash for unix tools like locate, grep and find. The git-bash tools spit out paths in the following form:

/c/path/to/file/file.txt

Emacs needs for functions like find-file, find-file-at-point or (with the helm-package) the function helm-find-file its paths in the form

c:/path/to/file/file.txt

I wrote a converter-function which converts the former into the latter and I hooked it via defadvice in expand-file-name. This works reasonable well (e.g. in my initial use case to make helm-locate cooperate with the git-bash locate).

However in some cases it does not work, like in interactive use of find-file-at-point. So my question is what is a more universal place to hook this converter in to make even interactive calls work properly?

Answer 1


jenesaisquoi's comment brought me to cygwin-mount.el. I tried it with gitbash - and it magically works!

The reason is that gitbash provides a similar mount command as cygwin does and gitbash's paths are cygwin paths as well.

Just make sure the gitbash binaries are in emacs' PATH environment variable.