home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 6.1.463 < prev    next >
Encoding:
Internet Message Format  |  2003-04-12  |  2.9 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.1.463
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 6.1.463
  11. Problem:    When writing a compressed file, the file name that gzip stores in
  12.         the file is the weird temporary file name. (David Rennalls)
  13. Solution:   Use the real file name when possible.
  14. Files:        runtime/plugin/gzip.vim
  15.  
  16.  
  17. *** ../vim61.462/runtime/plugin/gzip.vim    Tue Oct  1 19:34:38 2002
  18. --- runtime/plugin/gzip.vim    Sun Apr  6 17:30:34 2003
  19. ***************
  20. *** 1,6 ****
  21.   " Vim plugin for editing compressed files.
  22.   " Maintainer: Bram Moolenaar <Bram@vim.org>
  23. ! " Last Change: 2002 Oct 01
  24.   
  25.   " Exit quickly when:
  26.   " - this plugin was already loaded
  27. --- 1,6 ----
  28.   " Vim plugin for editing compressed files.
  29.   " Maintainer: Bram Moolenaar <Bram@vim.org>
  30. ! " Last Change: 2003 Apr 06
  31.   
  32.   " Exit quickly when:
  33.   " - this plugin was already loaded
  34. ***************
  35. *** 103,111 ****
  36.   fun s:write(cmd)
  37.     " don't do anything if the cmd is not supported
  38.     if s:check(a:cmd)
  39. !     " Rename to a weird name to avoid the risk of overwriting another file
  40.       let nm = expand("<afile>")
  41. !     let nmt = expand("<afile>:p:h") . "/X~=@l9q5"
  42.       if rename(nm, nmt) == 0
  43.         call system(a:cmd . " " . nmt)
  44.         call rename(nmt . "." . expand("<afile>:e"), nm)
  45. --- 103,111 ----
  46.   fun s:write(cmd)
  47.     " don't do anything if the cmd is not supported
  48.     if s:check(a:cmd)
  49. !     " Rename the file before compressing it.
  50.       let nm = expand("<afile>")
  51. !     let nmt = s:tempname(nm)
  52.       if rename(nm, nmt) == 0
  53.         call system(a:cmd . " " . nmt)
  54.         call rename(nmt . "." . expand("<afile>:e"), nm)
  55. ***************
  56. *** 132,137 ****
  57. --- 132,148 ----
  58.         call rename(nmt, nm)
  59.       endif
  60.     endif
  61. + endfun
  62. + " find a file name for the file to be compressed.  Use "name" without an
  63. + " extension if possible.  Otherwise use a weird name to avoid overwriting an
  64. + " existing file.
  65. + fun s:tempname(name)
  66. +   let fn = fnamemodify(a:name, ":r")
  67. +   if !filereadable(fn) && !isdirectory(fn)
  68. +     return fn
  69. +   endif
  70. +   return fnamemodify(a:name, ":p:h") . "/X~=@l9q5"
  71.   endfun
  72.   
  73.   " vim: set sw=2 :
  74. *** ../vim61.462/src/version.c    Sun Apr 13 20:42:39 2003
  75. --- src/version.c    Sun Apr 13 20:44:28 2003
  76. ***************
  77. *** 613,614 ****
  78. --- 613,616 ----
  79.   {   /* Add new patch number below this line */
  80. + /**/
  81. +     463,
  82.   /**/
  83.  
  84. -- 
  85. ARTHUR:    ... and I am your king ....
  86. OLD WOMAN: Ooooh!  I didn't know we had a king.  I thought we were an
  87.            autonomous collective ...
  88.                  "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
  89.  
  90.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  91. ///          Creator of Vim - Vi IMproved -- http://www.Vim.org          \\\
  92. \\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
  93.  \\\     Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///
  94.