From f526e2b8bce040ac91a6b3e1bf7dc297f9f2ca23 Mon Sep 17 00:00:00 2001 From: Peter Odding Date: Sun, 4 Sep 2011 13:56:11 +0200 Subject: Write tags files to temporary files, then rename() into place (issue #16) --- autoload/xolox/easytags.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/autoload/xolox/easytags.vim b/autoload/xolox/easytags.vim index 4069f28..6b0a36e 100644 --- a/autoload/xolox/easytags.vim +++ b/autoload/xolox/easytags.vim @@ -3,7 +3,7 @@ " Last Change: September 4, 2011 " URL: http://peterodding.com/code/vim/easytags/ -let g:xolox#easytags#version = '2.5.2' +let g:xolox#easytags#version = '2.5.3' " Public interface through (automatic) commands. {{{1 @@ -472,7 +472,8 @@ function! xolox#easytags#write_tagsfile(tagsfile, headers, entries) " {{{2 call extend(lines, a:headers) call extend(lines, a:entries) endif - return writefile(lines, a:tagsfile) == 0 + let tempname = a:tagsfile . '.easytags.tmp' + return writefile(lines, tempname) == 0 && rename(tempname, a:tagsfile) == 0 endfunction function! s:join_entry(value) -- cgit v1.2.3