On Tuesday, May 15, 2012 1:33:39 PM UTC-5, Bram Moolenaar wrote:
> Ben Fritz wrote:
> 
> > On Monday, May 14, 2012 2:39:54 PM UTC-5, Gary Johnson wrote:
> > > 
> > > As I understand the problem, they also had to have 'nobackup' and
> > > 'nowritebackup' set, the latter which is not the default.  So the
> > > user threw away the safety net, disregarded the warning sign, and
> > > because of this I have to wait longer each time I write a file?
> > > 
> > > Of course, if the slowdown is negligible, then there's probably no
> > > reason not to go with Christian's change.
> > > 
> > 
> > Since the error only occurs if 'backup' and 'writebackup' are both
> > off, maybe we could only do the "dry run" conversion in this
> > situation? I.e., if either 'backup' or 'writebackup' are set, do what
> > Vim has always done; but if neither are set, do the extra check first.
> > We could even put a nice notice in :help 'writebackup' saying "if this
> > option is off, writing the file will take longer due to extra safety
> > checks" to discourage turning it off in the first place.
> 
> The 'writebackup' option is to catch cases where writing fails.  It
> means that Vim can restore the original file.  There is no point in
> additional work.
> 
> If a user switches off 'writebackup' he must be prepared for losing
> work.  Perhaps this is not sufficiently clear to the user?
> 
> Considering how very few times this problem occurs I don't think it is
> justified to do any work on this.  Except perhaps a better explanation
> in the docs in some place.
> 

I don't think it's clear at all. The help for 'writebackup' gives no indication 
that this option is important to leave on to prevent losing not just your edits 
in progress, but the entire file you're editing. This is especially surprising 
when the write error has nothing to do with the ability to write to the 
filesystem, only with Vim's ability to convert characters between encodings. 
Additionally, it's not just a matter of 'writebackup'. The 'backupskip' option 
prevents 'writebackup' from taking effect if it matches. So if a user is 
editing a file in the 'backupskip' pattern, potentially in a directory covered 
by this pattern BY DEFAULT, like /tmp, they risk losing data.

I don't think that default Vim settings should ever let Vim delete an entire 
file without being asked to do so.

At least this thread prompted me to double-check and make sure 'writebackup' is 
safely set on my system :-)

-- 
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

Reply via email to