Karsten Hopp 5579d1
To: vim-dev@vim.org
Karsten Hopp 5579d1
Subject: Patch 7.1.305
Karsten Hopp 5579d1
Fcc: outbox
Karsten Hopp 5579d1
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 5579d1
Mime-Version: 1.0
Karsten Hopp 5579d1
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 5579d1
Content-Transfer-Encoding: 8bit
Karsten Hopp 5579d1
------------
Karsten Hopp 5579d1
Karsten Hopp 5579d1
Patch 7.1.305
Karsten Hopp 5579d1
Problem:    Editing a compressed file with special characters in the name
Karsten Hopp 5579d1
	    doesn't work properly.
Karsten Hopp 5579d1
Solution:   Escape special characters.
Karsten Hopp 5579d1
Files:	    runtime/autoload/gzip.vim
Karsten Hopp 5579d1
Karsten Hopp 5579d1
Karsten Hopp 5579d1
*** ../vim-7.1.304/runtime/autoload/gzip.vim	Thu May 10 18:54:26 2007
Karsten Hopp 5579d1
--- runtime/autoload/gzip.vim	Thu May 29 22:30:59 2008
Karsten Hopp 5579d1
***************
Karsten Hopp 5579d1
*** 1,6 ****
Karsten Hopp 5579d1
  " Vim autoload file for editing compressed files.
Karsten Hopp 5579d1
  " Maintainer: Bram Moolenaar <Bram@vim.org>
Karsten Hopp 5579d1
! " Last Change: 2007 May 10
Karsten Hopp 5579d1
  
Karsten Hopp 5579d1
  " These functions are used by the gzip plugin.
Karsten Hopp 5579d1
  
Karsten Hopp 5579d1
--- 1,6 ----
Karsten Hopp 5579d1
  " Vim autoload file for editing compressed files.
Karsten Hopp 5579d1
  " Maintainer: Bram Moolenaar <Bram@vim.org>
Karsten Hopp 5579d1
! " Last Change: 2008 May 29
Karsten Hopp 5579d1
  
Karsten Hopp 5579d1
  " These functions are used by the gzip plugin.
Karsten Hopp 5579d1
  
Karsten Hopp 5579d1
***************
Karsten Hopp 5579d1
*** 73,80 ****
Karsten Hopp 5579d1
    let empty = line("'[") == 1 && line("']") == line("$")
Karsten Hopp 5579d1
    let tmp = tempname()
Karsten Hopp 5579d1
    let tmpe = tmp . "." . expand("<afile>:e")
Karsten Hopp 5579d1
    " write the just read lines to a temp file "'[,']w tmp.gz"
Karsten Hopp 5579d1
!   execute "silent '[,']w " . escape(tmpe, ' ')
Karsten Hopp 5579d1
    " uncompress the temp file: call system("gzip -dn tmp.gz")
Karsten Hopp 5579d1
    call system(a:cmd . " " . s:escape(tmpe))
Karsten Hopp 5579d1
    if !filereadable(tmp)
Karsten Hopp 5579d1
--- 73,87 ----
Karsten Hopp 5579d1
    let empty = line("'[") == 1 && line("']") == line("$")
Karsten Hopp 5579d1
    let tmp = tempname()
Karsten Hopp 5579d1
    let tmpe = tmp . "." . expand("<afile>:e")
Karsten Hopp 5579d1
+   if exists('*fnameescape')
Karsten Hopp 5579d1
+     let tmp_esc = fnameescape(tmp)
Karsten Hopp 5579d1
+     let tmpe_esc = fnameescape(tmpe)
Karsten Hopp 5579d1
+   else
Karsten Hopp 5579d1
+     let tmp_esc = escape(tmp, ' ')
Karsten Hopp 5579d1
+     let tmpe_esc = escape(tmpe, ' ')
Karsten Hopp 5579d1
+   endif
Karsten Hopp 5579d1
    " write the just read lines to a temp file "'[,']w tmp.gz"
Karsten Hopp 5579d1
!   execute "silent '[,']w " . tmpe_esc
Karsten Hopp 5579d1
    " uncompress the temp file: call system("gzip -dn tmp.gz")
Karsten Hopp 5579d1
    call system(a:cmd . " " . s:escape(tmpe))
Karsten Hopp 5579d1
    if !filereadable(tmp)
Karsten Hopp 5579d1
***************
Karsten Hopp 5579d1
*** 95,106 ****
Karsten Hopp 5579d1
      setlocal nobin
Karsten Hopp 5579d1
      if exists(":lockmarks")
Karsten Hopp 5579d1
        if empty
Karsten Hopp 5579d1
! 	execute "silent lockmarks " . l . "r ++edit " . tmp
Karsten Hopp 5579d1
        else
Karsten Hopp 5579d1
! 	execute "silent lockmarks " . l . "r " . tmp
Karsten Hopp 5579d1
        endif
Karsten Hopp 5579d1
      else
Karsten Hopp 5579d1
!       execute "silent " . l . "r " . tmp
Karsten Hopp 5579d1
      endif
Karsten Hopp 5579d1
  
Karsten Hopp 5579d1
      " if buffer became empty, delete trailing blank line
Karsten Hopp 5579d1
--- 102,113 ----
Karsten Hopp 5579d1
      setlocal nobin
Karsten Hopp 5579d1
      if exists(":lockmarks")
Karsten Hopp 5579d1
        if empty
Karsten Hopp 5579d1
! 	execute "silent lockmarks " . l . "r ++edit " . tmp_esc
Karsten Hopp 5579d1
        else
Karsten Hopp 5579d1
! 	execute "silent lockmarks " . l . "r " . tmp_esc
Karsten Hopp 5579d1
        endif
Karsten Hopp 5579d1
      else
Karsten Hopp 5579d1
!       execute "silent " . l . "r " . tmp_esc
Karsten Hopp 5579d1
      endif
Karsten Hopp 5579d1
  
Karsten Hopp 5579d1
      " if buffer became empty, delete trailing blank line
Karsten Hopp 5579d1
***************
Karsten Hopp 5579d1
*** 110,117 ****
Karsten Hopp 5579d1
      endif
Karsten Hopp 5579d1
      " delete the temp file and the used buffers
Karsten Hopp 5579d1
      call delete(tmp)
Karsten Hopp 5579d1
!     silent! exe "bwipe " . tmp
Karsten Hopp 5579d1
!     silent! exe "bwipe " . tmpe
Karsten Hopp 5579d1
    endif
Karsten Hopp 5579d1
  
Karsten Hopp 5579d1
    " Restore saved option values.
Karsten Hopp 5579d1
--- 117,124 ----
Karsten Hopp 5579d1
      endif
Karsten Hopp 5579d1
      " delete the temp file and the used buffers
Karsten Hopp 5579d1
      call delete(tmp)
Karsten Hopp 5579d1
!     silent! exe "bwipe " . tmp_esc
Karsten Hopp 5579d1
!     silent! exe "bwipe " . tmpe_esc
Karsten Hopp 5579d1
    endif
Karsten Hopp 5579d1
  
Karsten Hopp 5579d1
    " Restore saved option values.
Karsten Hopp 5579d1
***************
Karsten Hopp 5579d1
*** 124,133 ****
Karsten Hopp 5579d1
  
Karsten Hopp 5579d1
    " When uncompressed the whole buffer, do autocommands
Karsten Hopp 5579d1
    if ok && empty
Karsten Hopp 5579d1
      if &verbose >= 8
Karsten Hopp 5579d1
!       execute "doau BufReadPost " . expand("%:r")
Karsten Hopp 5579d1
      else
Karsten Hopp 5579d1
!       execute "silent! doau BufReadPost " . expand("%:r")
Karsten Hopp 5579d1
      endif
Karsten Hopp 5579d1
    endif
Karsten Hopp 5579d1
  endfun
Karsten Hopp 5579d1
--- 131,145 ----
Karsten Hopp 5579d1
  
Karsten Hopp 5579d1
    " When uncompressed the whole buffer, do autocommands
Karsten Hopp 5579d1
    if ok && empty
Karsten Hopp 5579d1
+     if exists('*fnameescape')
Karsten Hopp 5579d1
+       let fname = fnameescape(expand("%:r"))
Karsten Hopp 5579d1
+     else
Karsten Hopp 5579d1
+       let fname = escape(expand("%:r"), " \t\n*?[{`$\\%#'\"|!<")
Karsten Hopp 5579d1
+     endif
Karsten Hopp 5579d1
      if &verbose >= 8
Karsten Hopp 5579d1
!       execute "doau BufReadPost " . fname
Karsten Hopp 5579d1
      else
Karsten Hopp 5579d1
!       execute "silent! doau BufReadPost " . fname
Karsten Hopp 5579d1
      endif
Karsten Hopp 5579d1
    endif
Karsten Hopp 5579d1
  endfun
Karsten Hopp 5579d1
*** ../vim-7.1.304/src/version.c	Thu May 29 21:46:10 2008
Karsten Hopp 5579d1
--- src/version.c	Thu May 29 22:33:11 2008
Karsten Hopp 5579d1
***************
Karsten Hopp 5579d1
*** 668,669 ****
Karsten Hopp 5579d1
--- 673,676 ----
Karsten Hopp 5579d1
  {   /* Add new patch number below this line */
Karsten Hopp 5579d1
+ /**/
Karsten Hopp 5579d1
+     305,
Karsten Hopp 5579d1
  /**/
Karsten Hopp 5579d1
Karsten Hopp 5579d1
-- 
Karsten Hopp 5579d1
OLD WOMAN: Well, how did you become king, then?
Karsten Hopp 5579d1
ARTHUR: The Lady of the Lake, her arm clad in the purest shimmering samite,
Karsten Hopp 5579d1
        held Excalibur aloft from the bosom of the water to signify by Divine
Karsten Hopp 5579d1
        Providence ...  that I, Arthur, was to carry Excalibur ...  That is
Karsten Hopp 5579d1
        why I am your king!
Karsten Hopp 5579d1
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
Karsten Hopp 5579d1
Karsten Hopp 5579d1
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 5579d1
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 5579d1
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 5579d1
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///