[net.news] Postnews and vi -- odd behavior

wmartin@brl-tgr.ARPA (Will Martin ) (05/02/85)

I have noticed the following odd behavior in postnews when using the vi editor;
is this standard amongst all news-running systems or local? If standard, is
it intentional or a bug?

Sometimes, when running postnews, I want to save a copy of my posting 
before submitting it. I am in vi, finishing the composition and editing.
I do ":w filename" and it works OK, and the screen still shows the text
of the posting. I then do "ZZ" and the system responds with:
"File not modified - no message posted" and then the shell prompt appears.

(I just did it again to verify this.) As far as I know, doing a "w" to 
another filename in vi should NOT affect the status of the editing buffer
(or whatever you call the space wherein vi works on the data), and, as I
said, after doing the "w filename" command, the data is still there. So 
maybe the pointer to the temporary postnews file is being destroyed?
But I thought that vi's "memory" of the original filename wouldn't be
affected by a command to explicitly "w" to another file.

I can, of course, recover by restarting postnews, reading in the saved
file, and deleting the duplicated header info, but it is a waste of time.

I don't notice this behavior when posting from within "rn", so I got
used to the practice of saving with the "w filename" command. However,
postnews is less offensive in the number of questions and gorp the user
has to wade through to do something, so I prefer stand-alone "postnews".

Any comments?

Will Martin

USENET: seismo!brl-bmd!wmartin     or   ARPA/MILNET: wmartin@almsa-1.ARPA

chris@umcp-cs.UUCP (Chris Torek) (05/02/85)

It's a vi bug: ":w filename" doesn't reset the editing-file file name, but
it does reset the flag vi uses to tell whether you've modified the file since
you started.  (Type ^G [or :f] to see.)  Since ZZ (which is equivalent to
":x") checks this flag, if you haven't made other changes, vi forgets to
write the original file again.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251)
UUCP:	{seismo,allegra,brl-bmd}!umcp-cs!chris
CSNet:	chris@umcp-cs		ARPA:	chris@maryland

ken@turtlevax.UUCP (Ken Turkowski) (05/06/85)

In article <10365@brl-tgr.ARPA> wmartin@brl-tgr.ARPA (Will Martin ) writes:
>Sometimes, when running postnews, I want to save a copy of my posting 
>before submitting it. I am in vi, finishing the composition and editing.
>I do ":w filename" and it works OK, and the screen still shows the text
>of the posting. I then do "ZZ" and the system responds with:
>"File not modified - no message posted" and then the shell prompt appears.

The problem is not in postnews or any of the news software, but in vi
itself.  There are various circumstances under which "ZZ" will not
write out a file before exiting.  I lost several hours worth of editing
this way, and haven't used the two-character "ZZ" command since,
preferring the predictable behavior of the three-character sequence
":wq" instead.
-- 

Ken Turkowski @ CADLINC, Menlo Park, CA
UUCP: {amd,decwrl,hplabs,nsc,seismo,spar}!turtlevax!ken
ARPA: turtlevax!ken@DECWRL.ARPA