all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* specifying Windows filenames
@ 2003-06-23 14:57 Gustaf Erikson
  2003-06-23 16:18 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Gustaf Erikson @ 2003-06-23 14:57 UTC (permalink / raw)


Hi!

I'm using NTEmacs 20.7 on WindowsXP. I'm trying to call a perl script
in the "H:\bin\" directory with shell-command-on-region. Perl is from
the Cygwin distribution.

I've tried specifying the command  in different ways: 

"H:/bin/command.pl" throws up the script in Notepad(!) So does
"H:\\bin\\command.pl".

"H:\bin\command.pl" doesn't work at all. 

Any tips? Do I need to specify the Cygwin bash shell first?

tia,

/g.

-- 
Gustaf Erikson <<< mobile: 073-338 76 18 >>> http://stureby.net/gustaf/
Five days is not too long to wait for a gun.
                                                        -- Bart Simpson

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: specifying Windows filenames
  2003-06-23 14:57 specifying Windows filenames Gustaf Erikson
@ 2003-06-23 16:18 ` Eli Zaretskii
       [not found] ` <mailman.8475.1056385357.21513.help-gnu-emacs@gnu.org>
  2003-06-24  8:03 ` [solved] " Gustaf Erikson
  2 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2003-06-23 16:18 UTC (permalink / raw)


> Newsgroups: gnu.emacs.help
> From: Gustaf Erikson <gustafe+usenet@openbsd.agero.se>
> Date: Mon, 23 Jun 2003 16:57:52 +0200
> 
> I'm using NTEmacs 20.7 on WindowsXP. I'm trying to call a perl script
> in the "H:\bin\" directory with shell-command-on-region. Perl is from
> the Cygwin distribution.
> 
> I've tried specifying the command  in different ways: 
> 
> "H:/bin/command.pl" throws up the script in Notepad(!) So does
> "H:\\bin\\command.pl".

I think this fails because Windows doesn't know about the "#!" magic
on the first line of command.pl.  (On Posix systems, the OS kernel
notices that magic string and handles the rest of the first line by
invoking the named interpreter on the script.)

I'd try this:

    M-x shell-command-on-region RET perl H:/bin/command.pl RET

Did that work?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: specifying Windows filenames
       [not found] ` <mailman.8475.1056385357.21513.help-gnu-emacs@gnu.org>
@ 2003-06-23 19:50   ` Jason Rumney
  2003-06-24  7:07   ` Harald Joerg
  1 sibling, 0 replies; 10+ messages in thread
From: Jason Rumney @ 2003-06-23 19:50 UTC (permalink / raw)


"Eli Zaretskii" <eliz@elta.co.il> writes:

> > Newsgroups: gnu.emacs.help
> > From: Gustaf Erikson <gustafe+usenet@openbsd.agero.se>
> > Date: Mon, 23 Jun 2003 16:57:52 +0200
> > 
> > I'm using NTEmacs 20.7 on WindowsXP. I'm trying to call a perl script
> > in the "H:\bin\" directory with shell-command-on-region. Perl is from
> > the Cygwin distribution.
> > 
> > I've tried specifying the command  in different ways: 
> > 
> > "H:/bin/command.pl" throws up the script in Notepad(!) So does
> > "H:\\bin\\command.pl".
> 
> I think this fails because Windows doesn't know about the "#!" magic
> on the first line of command.pl.

Right. You could get around this by finding where (under Folder
Options, File Types in the Explorer Tools menu) .pl files have been
associated with notepad.exe, and change it to perl.exe. Then they
should work as above, with the added bonus that they'll work when
double-clicked from explorer too.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: specifying Windows filenames
       [not found] ` <mailman.8475.1056385357.21513.help-gnu-emacs@gnu.org>
  2003-06-23 19:50   ` Jason Rumney
@ 2003-06-24  7:07   ` Harald Joerg
  2003-06-24  7:11     ` Jason Rumney
  1 sibling, 1 reply; 10+ messages in thread
From: Harald Joerg @ 2003-06-24  7:07 UTC (permalink / raw)


"Eli Zaretskii" <eliz@elta.co.il> writes:

>> Newsgroups: gnu.emacs.help
>> From: Gustaf Erikson <gustafe+usenet@openbsd.agero.se>
>> Date: Mon, 23 Jun 2003 16:57:52 +0200
>> 
>> I'm using NTEmacs 20.7 on WindowsXP. I'm trying to call a perl script
>> in the "H:\bin\" directory with shell-command-on-region. Perl is from
>> the Cygwin distribution.
>> 
>> I've tried specifying the command  in different ways: 
>> 
>> "H:/bin/command.pl" throws up the script in Notepad(!) So does
>> "H:\\bin\\command.pl".
>
> I think this fails because Windows doesn't know about the "#!" magic
> on the first line of command.pl.  (On Posix systems, the OS kernel
> notices that magic string and handles the rest of the first line by
> invoking the named interpreter on the script.)
>
> I'd try this:
>
>     M-x shell-command-on-region RET perl H:/bin/command.pl RET
>
> Did that work?

That's the same method I thought about in the first moment, but it
shouldn't work.  Gustaf says his Perl is cygwin's, so you'd have to use
cygwin notation:

     M-x shell-command-on-region RET perl /cygdrive/h/bin/command.pl RET

....and even this works only if cygwin Perl is on your _Windows_ PATH.

Mixing cygwin with "native" Windows ports is always tedious and error
prone.  You always have to consider which system is going to expand
and evaluate path names, though PATH and cygwin mounts help a bit.

However, you can shell-command-on-region a .bat file from NTEmacs, so
perhaps the easiest workaround is to write a small .bat file that sets
up the cygwin environment (which e.g. honors #!) and then fires up the
perl script.
-- 
Cheers,
haj

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: specifying Windows filenames
  2003-06-24  7:07   ` Harald Joerg
@ 2003-06-24  7:11     ` Jason Rumney
  2003-06-24  7:47       ` Harald Joerg
  0 siblings, 1 reply; 10+ messages in thread
From: Jason Rumney @ 2003-06-24  7:11 UTC (permalink / raw)


Harald Joerg <haj@oook.m.uunet.de> writes:

> >     M-x shell-command-on-region RET perl H:/bin/command.pl RET
> 
> That's the same method I thought about in the first moment, but it
> shouldn't work.  Gustaf says his Perl is cygwin's, so you'd have to use
> cygwin notation:

Cygwin understands Windows notation as input, it just doesn't produce
it as output.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: specifying Windows filenames
  2003-06-24  7:11     ` Jason Rumney
@ 2003-06-24  7:47       ` Harald Joerg
  2003-06-24 14:52         ` Eli Zaretskii
  2003-06-24 16:24         ` Jason Rumney
  0 siblings, 2 replies; 10+ messages in thread
From: Harald Joerg @ 2003-06-24  7:47 UTC (permalink / raw)


jasonr (Jason Rumney) @  f2s.com writes:

> Harald Joerg <haj@oook.m.uunet.de> writes:
>
>> >     M-x shell-command-on-region RET perl H:/bin/command.pl RET
>> 
>> That's the same method I thought about in the first moment, but it
>> shouldn't work.  Gustaf says his Perl is cygwin's, so you'd have to use
>> cygwin notation:
>
> Cygwin understands Windows notation as input, it just doesn't produce
> it as output.

Ooops!  Thanks for correcting that.

Sorry, I really should have checked this before.  I've been fooled by
the fact that cygwin _Emacs_ does not accept Windows notation.

Hmmm... what's the reason behind this Emacs behaviour?  unixish
assumptions in a built-in function (expand-file-name)?
-- 
Cheers,
haj

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [solved] specifying Windows filenames
  2003-06-23 14:57 specifying Windows filenames Gustaf Erikson
  2003-06-23 16:18 ` Eli Zaretskii
       [not found] ` <mailman.8475.1056385357.21513.help-gnu-emacs@gnu.org>
@ 2003-06-24  8:03 ` Gustaf Erikson
  2 siblings, 0 replies; 10+ messages in thread
From: Gustaf Erikson @ 2003-06-24  8:03 UTC (permalink / raw)


Gustaf Erikson <gustafe+usenet@openbsd.agero.se> writes:

> Hi!
>
> I'm using NTEmacs 20.7 on WindowsXP. I'm trying to call a perl script
> in the "H:\bin\" directory with shell-command-on-region. Perl is from
> the Cygwin distribution.
>
> I've tried specifying the command  in different ways: 
>
> "H:/bin/command.pl" throws up the script in Notepad(!) So does
> "H:\\bin\\command.pl".
>
> "H:\bin\command.pl" doesn't work at all. 
>
> Any tips? Do I need to specify the Cygwin bash shell first?
>
> tia,
>
> /g.

Many thanks to all who've helped with this.

To summarize: I've changed the call from "H:/bin/command.pl" to
"c:/cygwin/bin/perl.exe H:/bin/command.pl". This works fine.

Using the Windows file association to associate *.pl files with the
perl.exe executable sorta works too, but I don't get any output from a
module I use in the script. I suspect this is because the module path
isn't set correctly. I don't care about using perl scripts directly by
double-clicking, so I won't pursue this further.

/g.

-- 
Gustaf Erikson <<< mobile: 073-338 76 18 >>> http://stureby.net/gustaf/

     Ash nazg durbatulûk, ash nazg gimbatul, ash nazg thrakatulûk
		      agh burzum-ishi krimpatul.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: specifying Windows filenames
  2003-06-24  7:47       ` Harald Joerg
@ 2003-06-24 14:52         ` Eli Zaretskii
  2003-06-24 16:24         ` Jason Rumney
  1 sibling, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2003-06-24 14:52 UTC (permalink / raw)


> From: Harald Joerg <haj@oook.m.uunet.de>
> Newsgroups: gnu.emacs.help
> Date: Tue, 24 Jun 2003 09:47:29 +0200
> 
> Sorry, I really should have checked this before.  I've been fooled by
> the fact that cygwin _Emacs_ does not accept Windows notation.
> 
> Hmmm... what's the reason behind this Emacs behaviour?  unixish
> assumptions in a built-in function (expand-file-name)?

The Cygwin port is mostly unmodified Unix code (that's the crux of the
Cygwin project's philosophy), so it _must_ use Unixish assumptions,
almost by definition.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: specifying Windows filenames
  2003-06-24  7:47       ` Harald Joerg
  2003-06-24 14:52         ` Eli Zaretskii
@ 2003-06-24 16:24         ` Jason Rumney
  2003-06-25  7:55           ` Harald Joerg
  1 sibling, 1 reply; 10+ messages in thread
From: Jason Rumney @ 2003-06-24 16:24 UTC (permalink / raw)


Harald Joerg <haj@oook.m.uunet.de> writes:

> Sorry, I really should have checked this before.  I've been fooled by
> the fact that cygwin _Emacs_ does not accept Windows notation.

Really? The cygwin port is now merged into Emacs CVS, so
M-x report-emacs-bug

> Hmmm... what's the reason behind this Emacs behaviour?  unixish
> assumptions in a built-in function (expand-file-name)?

I would expect the Cygwin version to have the following behaviour:

(expand-file-name "c:/test")   -> "/cygdrive/c/test"
(expand-file-name "c:\\test")  -> "/cygdrive/c/test"


Does it do something different?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: specifying Windows filenames
  2003-06-24 16:24         ` Jason Rumney
@ 2003-06-25  7:55           ` Harald Joerg
  0 siblings, 0 replies; 10+ messages in thread
From: Harald Joerg @ 2003-06-25  7:55 UTC (permalink / raw)


jasonr (Jason Rumney) @  f2s.com writes:

> Harald Joerg <haj@oook.m.uunet.de> writes:
>
>> Sorry, I really should have checked this before.  I've been fooled by
>> the fact that cygwin _Emacs_ does not accept Windows notation.
>
> Really? The cygwin port is now merged into Emacs CVS, so
> M-x report-emacs-bug
>
I hesitate to report such things as "bugs", nevertheless, even if
every software which can be vanilla-installed from a cygwin mirror is
obligated to accept DOS paths (Is it?  That's OT here, of course).

Here and then I install stuff from elsewhere and I have been
accustomed to "`cygpath -u`" DOS paths if I find them.  I've learnt
now that I have been too careful for most cygwin stuff, but I think it
is sensible to be defensive as a general approach.

Just recently I have moved from NTEmacs to cygwin Emacs because I have
been unable to resolve the path misunderstandings (e.g. regarding
tempfiles) between NTEmacs and either Mailcrypt or bogofilter (the
latter two built on cygwin).  Hmm... maybe I should have asked
here...?

> [...]
> I would expect the Cygwin version to have the following behaviour:
>
> (expand-file-name "c:/test")   -> "/cygdrive/c/test"
> (expand-file-name "c:\\test")  -> "/cygdrive/c/test"
>
>
> Does it do something different?

I should have reported my Emacs version:
GNU Emacs 21.2.1 (i686-pc-cygwin, X toolkit) of 2003-01-23 on DRACO,
running on Win2000.
  (expand-file-name "c:/test")   -> "/usr/haj/c:/test"
  (expand-file-name "c:\\test")  -> "/usr/haj/c:\\test"
(my cwd happens to be /usr/haj). Maybe CVS Emacs is different.

-- 
Cheers,
haj

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2003-06-25  7:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-23 14:57 specifying Windows filenames Gustaf Erikson
2003-06-23 16:18 ` Eli Zaretskii
     [not found] ` <mailman.8475.1056385357.21513.help-gnu-emacs@gnu.org>
2003-06-23 19:50   ` Jason Rumney
2003-06-24  7:07   ` Harald Joerg
2003-06-24  7:11     ` Jason Rumney
2003-06-24  7:47       ` Harald Joerg
2003-06-24 14:52         ` Eli Zaretskii
2003-06-24 16:24         ` Jason Rumney
2003-06-25  7:55           ` Harald Joerg
2003-06-24  8:03 ` [solved] " Gustaf Erikson

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.