Subject: bug#7784: executable-find does not find scripts on woe32

From: Eli Zaretskii <[email-masked]>
Date: Wed, 05 Jan 2011 18:24:24 +0200

> Date: Wed, 5 Jan 2011 09:40:06 -0500
> From: Sam Steingold <[email-masked]>
> Cc: [email-masked], [email-masked]
> 
> On Wed, Jan 5, 2011 at 6:26 AM, Eli Zaretskii <[email-masked]> wrote:
> >> Date: Tue, 4 Jan 2011 23:05:16 -0500
> >> From: Sam Steingold <[email-masked]>
> >> Cc: [email-masked]
> >>
> >
> > Could you please describe the specific use-case where this issue got
> > in your way?  Because otherwise this discussion sounds a bit academic
> > to me.
> 
> when I try to use cygwin in native windows emacs, this works for
> binaries but not for scripts.
> e.g., using VC with cygwin-provided bzr and hg does not work.

Using any Emacs command that goes through shell-command-* should work
if you configure Emacs to use the Cygwin Bash as the shell.

Emacs commands that invoke programs directly (call/start-process etc.)
will not work with Unix shell scripts, but you can craft trivial *.bat
files that invoke the script via the Cygwin Bash, and put them on
PATH.  E.g., to invoke Cygwin bzr, create a bzr.bat (untested) with
this single line:

 @X:\path\to\cygwin\bash $*

> there is no reason for this not to work except for the
> check_executable()'s return value.

Yes, there is a reason: the native Windows build of Emacs uses native
Windows APIs to run subprocesses, and those APIs don't know how to run
a Unix shell script.

Or maybe I misunderstand the details, in which case please tell more
regarding the Emacs functions which failed (those that eventually
called executable-find) and the relevant error message(s).

In general, though, if you want to use Cygwin tools, I suggest to use
a Cygwin build of Emacs.  Then everything should "just work".