From f02ccb3a775d92704f6b5aef66da401f5820f039 Mon Sep 17 00:00:00 2001 From: Peter Odding Date: Mon, 30 Jun 2014 00:22:31 +0200 Subject: Refactor atomic file updates into a feature of vim-misc --- autoload/xolox/easytags/update.vim | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'autoload') diff --git a/autoload/xolox/easytags/update.vim b/autoload/xolox/easytags/update.vim index 996d0fb..ba089e0 100644 --- a/autoload/xolox/easytags/update.vim +++ b/autoload/xolox/easytags/update.vim @@ -1,6 +1,6 @@ " Vim script " Author: Peter Odding -" Last Change: June 29, 2014 +" Last Change: June 30, 2014 " URL: http://peterodding.com/code/vim/easytags/ " This Vim auto-load script contains the parts of vim-easytags that are used @@ -222,8 +222,9 @@ function! xolox#easytags#update#write_tagsfile(tagsfile, headers, entries) " {{{ call extend(lines, a:headers) call extend(lines, a:entries) endif - let tempname = a:tagsfile . '.easytags.tmp' - return writefile(lines, tempname) == 0 && rename(tempname, a:tagsfile) == 0 + " Write the new contents to a temporary file and atomically rename the + " temporary file into place while preserving the file's permissions. + return xolox#misc#perm#update(a:tagsfile, lines) endfunction function! s:enumerate(list) -- cgit v1.2.3