[Zope] Solution: External Edit and cygwin under W2k

Warnes, Gregory R gregory_r_warnes@groton.pfizer.com
Wed, 19 Jun 2002 13:17:30 -0400


Here is the necessary magic to use External Editor's zopeedit.py with
cygwin's python and xemacs under W2K:

1) Put zopeedit.py in your cygwin home directory (or edit the location in
the zopeedit.bat file).


2) In C:/cygwin/zopeedit.bat put:

	@echo off
	
	C:
	chdir \cygwin\bin
	
	START /MIN bash --login -c '~/zopeedit.py \'%1\' & echo HI! ; sleep
10; exit'

3) In ~/.zope-external-edit put:

	editor=xemacs

4) Set up your web browser and/or file associations per the usual
instructions to run

	C:\cygwin\zopeedit.bat

---

Notes:

1-  the escaped single quotes:  Without these "C:\temp\file.ext" gets
mangled to "C:tempfile.ext" before zopeedit.py gets it.  It took a bit of
fiddling to find this oh-so-simple solution.  I also tried using pythonw and
launching cygwin's xemacs from that.  Unfortunately, I couldn't find a way
to keep the filename from getting mangled that way.

2- START /MIN: there doesn't seem to be a way to prevent a command window
from hanging around as long as zopeedit.py and the associated xemacs window
are running.  With START /MIN, though, the window is at least minimized.

-Greg

> -----Original Message-----
> From: Casey Duncan [mailto:casey_duncan@yahoo.com]
> Sent: Tuesday, June 18, 2002 10:49 PM
> To: Warnes, Gregory R
> Subject: RE: zopeeditor
> 
> 
> You should be able to launch python inside cygwin
> somehow. I must say that cygwin is the only thing that
> makes Windows bearable... Good luck to you.
> 
> -Casey
> 
> --- "Warnes, Gregory R"
> <gregory_r_warnes@groton.pfizer.com> wrote:
> > Thanks for the V0.3.  I've managed to get it working
> > on Windows for Notepad
> > and WinEdt, but haven't yet figured out what magic
> > is necessary to get it to
> > work with my cygwin-based XEmacs.  When I get that
> > working, I'll email you
> > the ritual incantation and you can add it to your
> > docs...
> > 
> > -Greg
> > 
> > > -----Original Message-----
> > > From: Casey Duncan [mailto:casey_duncan@yahoo.com]
> > > Sent: Thursday, May 16, 2002 10:17 AM
> > > To: Warnes, Gregory R
> > > Subject: Re: zopeeditor
> > > 
> > > 
> > > For one, don't put quotes in the config file. I
> > also
> > > think tmpnam is broken on WIndows. try hard-coding
> > the
> > > temp directoy.
> > > 
> > > Other than that good luck. I know waitpid is
> > broken on
> > > Windows too. That is why I am going to write a
> > helper
> > > app specifically for Windows using the windows
> > > scripting host.
> > > 
> > > -Casey
> > > 
> > > --- "Warnes, Gregory R"
> > > <gregory_r_warnes@groton.pfizer.com> wrote:
> > > > 
> > > > Hi, I've just been playing around trying to get
> > > > zopeeditor working on the
> > > > windows box.  (I mostly use Windows as an xterm
> > +
> > > > local Mozilla +
> > > > MS-Outook).   I see that there is some code to
> > try
> > > > to make it work on win32,
> > > > but I'm having no luck.
> > > > 
> > > > I'm trying to get things working from the
> > command
> > > > line -- then onto Mozilla.
> > > > I've download a zope object 'test' and then run
> > > >  python zopeedit.py test
> > > > I'm getting errors.
> > > > 
> > > > When I have (in the config file)
> > > >  editor="Notepad"
> > > >  editor="C:\\winnt\\system32\\notepad.exe"
> > > > I always get:
> > > >  FATAL ERROR:
> > > >  Editor not found at "None"
> > > > 
> > > > When I have editor commented out, it hangs with
> > this
> > > > output:
> > > >  C:\cygwin\tmp>python zopeedit.py test
> > > >  zopeedit.py:104: RuntimeWarning: tmpnam is a
> > > > potential security risk
> > > > to your pro
> > > >  gram
> > > >    body_file = '%s-%s' % (os.tmpnam(),
> > body_file)
> > > > 
> > > > 
> > > > Ideas?
> > > > 
> > > > -Greg
> > > > 
> > > > 
> > > > LEGAL NOTICE
> > > > Unless expressly stated otherwise, this message
> > is
> > > > confidential and may be privileged. It is
> > intended
> > > > for the addressee(s) only. Access to this E-mail
> > by
> > > > anyone else is unauthorized. If you are not an
> > > > addressee, any disclosure or copying of the
> > contents
> > > > of this E-mail or any action taken (or not
> > taken) in
> > > > reliance on it is unauthorized and may be
> > unlawful.
> > > > If you are not an addressee, please inform the
> > > > sender immediately.
> > > 
> > > __________________________________________________
> > > Do You Yahoo!?
> > > LAUNCH - Your Yahoo! Music Experience
> > > http://launch.yahoo.com
> > > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.com
>