On 16/04/10 00:38, Benjamin R. Haskell wrote:
On 2010-04-15, Tony Mechelynck wrote:

On 15/04/10 19:35, Benjamin R. Haskell wrote:

Twice recently I've failed to properly recover crashed Vim sessions
because I've followed this sequence of steps:

[...]
# respond with 'R' for recover
ZZ - to save and quit

$ vi somefile
[...]
# respond with 'D' to delete the swap file,
# since I just saved the recovered version
[...]

Why isn't the file considered to be 'modified' after it's changed by
the recovery process?  (Hence the 'ZZ' fails to save it.)


I think it's a bug; see thread ":wa don't save recovered files"
started 2010-02-19 02:15 -0800 by "smith"<  dmitriy DOT kuznetsov AT
gmail DOT com>  on this ML.

Yep.  Sounds like the same problem.


After recovering, you should check the results, and, if correct, do a
"forced write" with :w or :wq (not ZZ :x :wa or :xa).

[Only somewhat on-topic: By far my favorite reason for using 'git' comes
from a blog post entitled "The Thing About Git" by Ryan Tomayko[1], who
summed it up as: "Git means never having to say, “you should have”."]

So, yes.  I know that's what I'm *supposed* to do.  :-)

The reason I don't generally have this problem is that this is a corner
case of my usual pattern for recovery:

$ vi somefile
# get prompted to recover; choose 'R' for recover
** ( do some editing ) **
ZZ - to save
$ vi somefile
# get prompted to recover; choose 'D' to delete, since I just saved

(vi = vim, BTW -- I always alias it on systems that have vim installed)

The problem in the two recent cases (same in both) was that I was
well-aware that my previous session had crashed.  So, I was expecting
the differences -- and they matched my expectations -- so I skipped the
'do some editing' step.


But IMHO if the recovery modifies the buffer (i.e. makes it different
from the file on disk), it should also set the local 'modified'
option.

I agree.  This would solve this problem in both my case and the previous
poster's.


BTW which Vim version and patchlevel are you using? (as shown by the
first few lines of the output of :version, until the line ending
"Features included (+) or not (-):")

VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Mar  5 2010 09:03:28)
Included patches: 1-376
Modified by Gentoo-7.2.376
Compiled by paludisbu...@hp
Huge version without GUI.  Features included (+) or not (-):

Thanks as always, Tony.


Hm, 7.2.376, with unspecified mods by Gentoo.

I don't know if Bram's "latest of the greatest" source has a patch for your problem (see http://ftp.vim.org/pub/vim/patches/7.2/README which lists Bram's "official" patches to 7.2.411 as of this writing) but it includes 35 bugfixes you haven't got (admittedly including a few Windows ones I suppose, but usually most of them are platform-agnostic) and using it would clear away the Gentoo mods, of which we know nothing.

Compiling Vim on Linux isn't really hard (once you have the appropriate "development" packages installed), see http://users.skynet.be/antoine.mechelynck/vim/compunix.htm (and Bram has recently set up a Mercurial repository for the Vim source, which I'll mention on that page once I get around to trying it).


Happy Vimming!
Tony.
--
"For an adequate time call 555-3321"

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Subscription settings: http://groups.google.com/group/vim_use/subscribe?hl=en

Reply via email to