r211 - in trunk/vim/debian: . patches

James Vega jamessan-guest@costa.debian.org
Wed, 18 May 2005 17:34:49 +0000


Author: jamessan-guest
Date: 2005-05-18 17:34:48 +0000 (Wed, 18 May 2005)
New Revision: 211

Modified:
   trunk/vim/debian/changelog
   trunk/vim/debian/patches/125_gzip.vim.diff
Log:
Updated the gzip compression detection patch so it doesn't rely on od.


Modified: trunk/vim/debian/changelog
===================================================================
--- trunk/vim/debian/changelog	2005-05-15 17:17:35 UTC (rev 210)
+++ trunk/vim/debian/changelog	2005-05-18 17:34:48 UTC (rev 211)
@@ -1,3 +1,11 @@
+vim (1:6.3-071+3) unstable; urgency=low
+
+  * James Vega <jamessan@jamessan.com>
+    + Updated patch 125_gzip.vim.diff so that compression detection is
+      performed using Vim instead of external tools.
+
+ -- Debian VIM Maintainers <pkg-vim-maintainers@lists.alioth.debian.org>  Wed, 18 May 2005 13:31:23 -0400
+
 vim (1:6.3-071+2) unstable; urgency=low
 
   * Stefano Zacchiroli <zack@debian.org>:

Modified: trunk/vim/debian/patches/125_gzip.vim.diff
===================================================================
--- trunk/vim/debian/patches/125_gzip.vim.diff	2005-05-15 17:17:35 UTC (rev 210)
+++ trunk/vim/debian/patches/125_gzip.vim.diff	2005-05-18 17:34:48 UTC (rev 211)
@@ -1,35 +1,31 @@
---- 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 @@
+diff -ur vim63.orig/runtime/plugin/gzip.vim vim63/runtime/plugin/gzip.vim
+--- vim63.orig/runtime/plugin/gzip.vim	2005-05-18 13:15:05.000000000 -0400
++++ vim63/runtime/plugin/gzip.vim	2005-05-18 13:21:01.000000000 -0400
+@@ -48,12 +48,39 @@
    exe "return s:have_" . name
  endfun
  
++" Set a buffer local variable which contains the compression method used when
++" this file was compressed.  This can then be used later when we recompress
++" the file in s:write().  This only matters if we're using gzip.  The only
++" compression methods that can be detected are max speed (-1) and max
++" compression (-9).
 +fun s:set_compression()
-+  if !s:have_od
-+    let b:compression = ""
++  let b:compression = ""
++  if !s:have_gzip
 +    return
 +  endif
 +  " get the Compression Method
-+  let cm = system("od -j2 -N1 -d " . expand("<afile>"))
++  let l:cm = char2nr(getline('1')[2])
 +  " if it's 8 (DEFLATE), we can check for the compression level
-+  if match(cm, '\s8$')
++  if l:cm == 8
 +    " get the eXtra FLags
-+    let xfl = system("od -j8 -N1 -d " . expand("<afile>"))
++    let l:xfl = char2nr(getline('1')[8])
 +    " max compression
-+    if match(xfl, '\s2$') != -1
++    if l:xfl == 2
 +      let b:compression = "-9"
 +    " min compression
-+    elseif match(xfl, '\s4$') != -1
++    elseif l:xfl == 4
 +      let b:compression = "-1"
 +    endif
 +  endif
@@ -45,7 +41,7 @@
    " make 'patchmode' empty, we don't want a copy of the written file
    let pm_save = &pm
    set pm=
-@@ -116,7 +141,7 @@
+@@ -116,7 +143,7 @@
      let nm = resolve(expand("<afile>"))
      let nmt = s:tempname(nm)
      if rename(nm, nmt) == 0
@@ -54,7 +50,7 @@
        call rename(nmt . "." . expand("<afile>:e"), nm)
      endif
    endif
-@@ -126,6 +151,7 @@
+@@ -126,6 +153,7 @@
  fun s:appre(cmd)
    " don't do anything if the cmd is not supported
    if s:check(a:cmd)