To: vim-dev@vim.org Subject: Patch 6.1.463 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1.463 Problem: When writing a compressed file, the file name that gzip stores in the file is the weird temporary file name. (David Rennalls) Solution: Use the real file name when possible. Files: runtime/plugin/gzip.vim *** ../vim61.462/runtime/plugin/gzip.vim Tue Oct 1 19:34:38 2002 --- runtime/plugin/gzip.vim Sun Apr 6 17:30:34 2003 *************** *** 1,6 **** " Vim plugin for editing compressed files. " Maintainer: Bram Moolenaar ! " Last Change: 2002 Oct 01 " Exit quickly when: " - this plugin was already loaded --- 1,6 ---- " Vim plugin for editing compressed files. " Maintainer: Bram Moolenaar ! " Last Change: 2003 Apr 06 " Exit quickly when: " - this plugin was already loaded *************** *** 103,111 **** fun s:write(cmd) " don't do anything if the cmd is not supported if s:check(a:cmd) ! " Rename to a weird name to avoid the risk of overwriting another file let nm = expand("") ! let nmt = expand(":p:h") . "/X~=@l9q5" if rename(nm, nmt) == 0 call system(a:cmd . " " . nmt) call rename(nmt . "." . expand(":e"), nm) --- 103,111 ---- fun s:write(cmd) " don't do anything if the cmd is not supported if s:check(a:cmd) ! " Rename the file before compressing it. let nm = expand("") ! let nmt = s:tempname(nm) if rename(nm, nmt) == 0 call system(a:cmd . " " . nmt) call rename(nmt . "." . expand(":e"), nm) *************** *** 132,137 **** --- 132,148 ---- call rename(nmt, nm) endif endif + endfun + + " find a file name for the file to be compressed. Use "name" without an + " extension if possible. Otherwise use a weird name to avoid overwriting an + " existing file. + fun s:tempname(name) + let fn = fnamemodify(a:name, ":r") + if !filereadable(fn) && !isdirectory(fn) + return fn + endif + return fnamemodify(a:name, ":p:h") . "/X~=@l9q5" endfun " vim: set sw=2 : *** ../vim61.462/src/version.c Sun Apr 13 20:42:39 2003 --- src/version.c Sun Apr 13 20:44:28 2003 *************** *** 613,614 **** --- 613,616 ---- { /* Add new patch number below this line */ + /**/ + 463, /**/ -- ARTHUR: ... and I am your king .... OLD WOMAN: Ooooh! I didn't know we had a king. I thought we were an autonomous collective ... "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///