Hi Bram!
On Di, 25 Mai 2010, Bram Moolenaar wrote:
> Christian Brabandt wrote:
>
> This completely depends on what you are doing. When a file has been
> edited by someone else, using Vim, you can undo his changes. That can
> be very useful. On the other hand, the undo file will reveal anything
> you undid, perhaps things you never wanted others to see.
>
> We probably need to add an example for a BufWritePre autocommand that
> only sets 'undofile' for files under your home directory. Perhaps this
> works:
>
> set noundofile
> au BufWritePre $HOME/* setlocal undofile
>
> Untested!
Not sure this works. Further testing shows, that the provided binary
crashes always when using :wundo <filename> (doesn't matter what
undofile is set to). This does not happen with a self built mingw binary
or a cygwin binary.
> > BTW: If the undolevels setting is negative, you won't need to write a
> > undo-file, right?
>
> Yes, when there is no undo info the file should not be written. But an
> old file should still be deleted, as it will no longer be valid.
But if I set ul=-1 an undofile will still be written.
If I understand the code corectly, this should fix it:
chrisbra t41:~/vim/src [1070]% hg diff undo.c
diff -r 271a5907f944 src/undo.c
--- a/src/undo.c Tue May 25 22:09:21 2010 +0200
+++ b/src/undo.c Tue May 25 22:54:13 2010 +0200
@@ -1265,6 +1265,14 @@
perm = 0600;
#endif
}
+ if (p_ul <0)
+ {
+ mch_remove(file_name);
+ if (p_verbose > 0)
+ smsg((char_u *)_("'undolevels' is negative, won't write the
undofile: %s"),
+ file_name);
+ goto theend;
+ }
/* set file protection same as original file, but strip s-bit */
perm = perm & 0777;
regards,
Christian
--
You received this message from the "vim_dev" 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