diff options
author | Peter Odding <peter@peterodding.com> | 2014-06-30 00:22:31 +0200 |
---|---|---|
committer | Peter Odding <peter@peterodding.com> | 2014-06-30 00:22:31 +0200 |
commit | f02ccb3a775d92704f6b5aef66da401f5820f039 (patch) | |
tree | fa4c7d76e29e5c7fd571aa445ce9bc1f1719ae03 | |
parent | de47de82fd140607b44af833546fb4f46cd9f2f2 (diff) | |
download | vim-easytags-f02ccb3a775d92704f6b5aef66da401f5820f039.tar.gz |
Refactor atomic file updates into a feature of vim-misc
-rw-r--r-- | autoload/xolox/easytags/update.vim | 7 |
1 files changed, 4 insertions, 3 deletions
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 <peter@peterodding.com> -" 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) |