Only export emacs function if it exists

and use the right check for "running Git Bash on Windows".