[comp.bugs.4bsd] Losing my work in vi!

carlson@styx.UUCP (John Carlson) (12/19/86)

()
Time for a change!

I am always losing my work with ex/vi when the system goes down in the
middle of an edit session.  Later, I type

vi -r filename

to restore the file.  Then I make changes a few changes, or if I just
want to save it, I type

:x  (ex)

or

ZZ  (vi)

Guess what happens?  That's right, all of my changes are lost!  How
about setting the 'modified' flag whenever a restore is done?

John Carlson

ron@vsedev.VSE.COM (Ron Flax) (12/20/86)

In article <21107@styx.UUCP> carlson@styx.UUCP (John Carlson) writes:
	I am always losing my work with ex/vi when the system goes down in the
	middle of an edit session.  Later, I type
	
	
	vi -r filename
	
	to restore the file.  Then I make changes a few changes, or if I just
	want to save it, I type
	
	ZZ  (vi)

	Guess what happens?  That's right, all of my changes are lost!  How
	about setting the 'modified' flag whenever a restore is done?

Which version of vi are you running?  Mine which is 3.9, of 2/9/83 does 
as you suggest.

--
ron@vsedev.VSE.COM	(Ron Flax)
UUCP:	..!seismo!vsedev!ron
INET:	vsedev.VSE.COM!ron@seismo.CSS.GOV

dce@quacky.UUCP (David Elliott) (12/20/86)

In article <305@vsedev.VSE.COM> ron@vsedev.UUCP (Ron Flax) writes:
>In article <21107@styx.UUCP> carlson@styx.UUCP (John Carlson) writes:
>
>...
>	Guess what happens?  That's right, all of my changes are lost!  How
>	about setting the 'modified' flag whenever a restore is done?
>
>Which version of vi are you running?  Mine which is 3.9, of 2/9/83 does 
>as you suggest.
>

There are two problems here:

	1. The name of this newsgroup is comp.bugs.4bsd. 4.3BSD comes
	   with ex version 3.7. If Ron is running a BSD system, how can
	   he have 3.9, which is the version that comes with System V.3?
	   Anyway, 4.3BSD is broken in this regard (unless someone walked
	   on the sources again).

	2. As pointed out recently in this newsgroup, the proper solution
	   is to set the modified and not edited (really unsetting the
	   edited) flags.

If you just set the modified flag, this can happen:
	
	vi file
	...
	system crash or phone line lost
	log in again
	continue editing
	save changes
	read mail and find out you need to recover, or just run vi -r
	vi -r file
	ZZ
	OOPS! You just undid your changes.

By setting the 'not edited' state, you have to do a w!, which requires
a little extra thought.

At Tektronix, the people in Tony Birnseth's group changed vi to have a
'recovered' state. I don't know if this implied the above, but it was
nice to do a :f or ^G and see '[Recovered]'.

			David Elliott
			Mips Computer Systems

guy%gorodish@Sun.COM (Guy Harris) (12/21/86)

> 	1. The name of this newsgroup is comp.bugs.4bsd. 4.3BSD comes
> 	   with ex version 3.7. If Ron is running a BSD system, how can
> 	   he have 3.9, which is the version that comes with System V.3?

No, it's the version that comes with System V.2, but that's neither here nor
there.  If you bring "curses"/"terminfo" up on a BSD system (it has plenty
of #ifdefs for that, although it would require some work - for one thing,
the SIGTSTP code is for 4.1BSD, assumes that signal handlers are reset when
a signal occurs, and will thus go into an infinite loop if you try to
suspend a "curses" program), and spend a little more time on "ex" itself,
you can bring it up on a BSD system as well.  *That's* how he could have 3.9.

However, the point is well taken that bugs in "ex" 3.9 would properly appear
in "comp.bugs.sys5", not "comp.bugs.4bsd", so bugs in "ex" appearing in
"comp.bugs.4bsd" should be assume to apply to one or the other versions of
"ex" 3.7 (yup, the 4.3BSD one is different from the 4.2BSD one, but they
didn't change the version number).