r202 - in trunk/vim/debian: . patches

James Vega jamessan-guest@costa.debian.org
Sun, 08 May 2005 07:29:15 +0000


Author: jamessan-guest
Date: 2005-05-08 07:29:14 +0000 (Sun, 08 May 2005)
New Revision: 202

Added:
   trunk/vim/debian/patches/125_gzip.vim.diff
Modified:
   trunk/vim/debian/changelog
Log:
Add 125_gzip.vim.diff (closes #280388), maintain compression levels when
editing gzip files.


Modified: trunk/vim/debian/changelog
===================================================================
--- trunk/vim/debian/changelog	2005-05-07 23:14:51 UTC (rev 201)
+++ trunk/vim/debian/changelog	2005-05-08 07:29:14 UTC (rev 202)
@@ -22,8 +22,13 @@
   * Matthijs Mohlmann <matthijs@cacholong.nl>:
     + Added patch for german accents. (Closes: #307807)
 
- -- Debian VIM Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>  Fri,  6 May 2005 00:03:56 +0200
+  * James Vega <jamessan@jamessan.com>:
+    + Added patch 125_gzip.vim.diff, maintain "max speed" and "max
+      compression" compression levels when editing gzip files.
+      (Closes: #280388)
 
+ -- Debian VIM Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>  Sun,  8 May 2005 03:07:48 -0400
+
 vim (1:6.3-071+1) unstable; urgency=medium
 
   * New upstream patches (069 to 071), see README.gz for details.

Added: trunk/vim/debian/patches/125_gzip.vim.diff
===================================================================
--- trunk/vim/debian/patches/125_gzip.vim.diff	2005-05-07 23:14:51 UTC (rev 201)
+++ trunk/vim/debian/patches/125_gzip.vim.diff	2005-05-08 07:29:14 UTC (rev 202)
@@ -0,0 +1,64 @@
+--- vim63.old/runtime/plugin/gzip.vim	2005-05-07 22:17:54.000000000 -0400
++++ vim63/runtime/plugin/gzip.vim	2005-05-08 02:58:38.674896896 -0400
+@@ -37,6 +37,9 @@
+ " The result is cached in s:have_"cmd" for speed.
+ fun s:check(cmd)
+   let name = substitute(a:cmd, '\(\S*\).*', '\1', '')
++  if name =~ "gzip"
++    call s:check("od")
++  endif
+   if !exists("s:have_" . name)
+     let e = executable(name)
+     if e < 0
+@@ -48,12 +51,34 @@
+   exe "return s:have_" . name
+ endfun
+ 
++fun s:set_compression()
++  if !s:have_od
++    let b:compression = ""
++    return
++  endif
++  " get the Compression Method
++  let cm = system("od -j2 -N1 -d " . expand("<afile>"))
++  " if it's 8 (DEFLATE), we can check for the compression level
++  if match(cm, '\s8$')
++    " get the eXtra FLags
++    let xfl = system("od -j8 -N1 -d " . expand("<afile>"))
++    " max compression
++    if match(xfl, '\s2$') != -1
++      let b:compression = "-9"
++    " min compression
++    elseif match(xfl, '\s4$') != -1
++      let b:compression = "-1"
++    endif
++  endif
++endfun
++
+ " After reading compressed file: Uncompress text in buffer with "cmd"
+ fun s:read(cmd)
+   " don't do anything if the cmd is not supported
+   if !s:check(a:cmd)
+     return
+   endif
++  call s:set_compression()
+   " make 'patchmode' empty, we don't want a copy of the written file
+   let pm_save = &pm
+   set pm=
+@@ -116,7 +141,7 @@
+     let nm = resolve(expand("<afile>"))
+     let nmt = s:tempname(nm)
+     if rename(nm, nmt) == 0
+-      call system(a:cmd . " " . nmt)
++      call system(a:cmd . " " . b:compression . " " . nmt)
+       call rename(nmt . "." . expand("<afile>:e"), nm)
+     endif
+   endif
+@@ -126,6 +151,7 @@
+ fun s:appre(cmd)
+   " don't do anything if the cmd is not supported
+   if s:check(a:cmd)
++    call s:set_compression()
+     " Rename to a weird name to avoid the risk of overwriting another file
+     let nm = expand("<afile>")
+     let nmt = expand("<afile>:p:h") . "/X~=@l9q5"