summaryrefslogtreecommitdiffstats
path: root/vim/xz.patch
blob: 0ee9b2a99aab135100389852f3c33beb35e2a658 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
diff -uNr vim72/autoload/getscript.vim vim72-xz/autoload/getscript.vim
--- vim72/autoload/getscript.vim	2010-05-16 22:33:59.000000000 +0200
+++ vim72-xz/autoload/getscript.vim	2010-05-16 22:41:34.930283754 +0200
@@ -557,6 +557,11 @@
       exe "silent !gunzip ".shellescape(sname)
       let sname= substitute(sname,'\.gz$','','')
 "      call Decho("decompress: new sname<".sname."> after gunzip")
+     elseif sname =~ '\.xz$'
+"      call Decho("decompress: attempt to unxz ".sname)
+      exe "silent !unxz ".shellescape(sname)
+      let sname= substitute(sname,'\.xz$','','')
+"      call Decho("decompress: new sname<".sname."> after unxz")
      else
 "      call Decho("no decompression needed")
      endif
diff -uNr vim72/autoload/netrw.vim vim72-xz/autoload/netrw.vim
--- vim72/autoload/netrw.vim	2010-05-16 22:33:59.000000000 +0200
+++ vim72-xz/autoload/netrw.vim	2010-05-16 22:40:28.007276216 +0200
@@ -163,7 +163,7 @@
 endif
 " Default values - d-g ---------- {{{3
 call s:NetrwInit("g:netrw_dirhist_cnt"      , 0)
-call s:NetrwInit("g:netrw_decompress"       , '{ ".gz" : "gunzip", ".bz2" : "bunzip2", ".zip" : "unzip", ".tar" : "tar -xf"}')
+call s:NetrwInit("g:netrw_decompress"       , '{ ".gz" : "gunzip", ".bz2" : "bunzip2", ".xz" : "unxz", ".zip" : "unzip", ".tar" : "tar -xf" }')
 call s:NetrwInit("g:netrw_dirhistmax"       , 10)
 call s:NetrwInit("g:netrw_fastbrowse"       , 1)
 call s:NetrwInit("g:netrw_ftp_browse_reject", '^total\s\+\d\+$\|^Trying\s\+\d\+.*$\|^KERBEROS_V\d rejected\|^Security extensions not\|No such file\|: connect to address [0-9a-fA-F:]*: No route to host$')
@@ -920,7 +920,7 @@
    unlet b:netrw_method
    unlet b:netrw_fname
   endif
-  if s:FileReadable(tmpfile) && tmpfile !~ '.tar.bz2$' && tmpfile !~ '.tar.gz$' && tmpfile !~ '.zip' && tmpfile !~ '.tar' && readcmd != 't'
+  if s:FileReadable(tmpfile) && tmpfile !~ '.tar.xz$' && tmpfile !~ '.tar.bz2$' && tmpfile !~ '.tar.gz$' && tmpfile !~ '.zip' && tmpfile !~ '.tar' && readcmd != 't'
 "   call Decho("cleanup by deleting tmpfile<".tmpfile.">")
    call s:NetrwDelete(tmpfile)
   endif
@@ -1387,6 +1387,9 @@
    elseif rfile =~ '\.tar\.bz2'
 "    call Decho("handling remote bz2-compressed tar file")
     call tar#Browse(tfile)
+   elseif rfile =~ '\.tar\.xz'
+"    call Decho("handling remote xz-compressed tar file")
+    call tar#Browse(tfile)
    else
 "    call Decho("edit temporary file")
     e!
@@ -2312,7 +2315,7 @@
    exe "sil! keepalt file ".fnameescape(s:method."://".s:user.s:machine."/".s:path)
    exe "sil keepalt doau BufReadPre ".fnameescape(s:fname)
    silent call netrw#NetRead(2,s:method."://".s:user.s:machine."/".s:path)
-   if s:path !~ '.tar.bz2$' && s:path !~ '.tar.gz'
+   if s:path !~ '.tar.xz' && s:path !~ '.tar.bz2$' && s:path !~ '.tar.gz'
     " netrw.vim and tar.vim have already handled decompression of the tarball; avoiding gzip.vim error
     exe "sil keepalt doau BufReadPost ".fnameescape(s:fname)
    endif
@@ -4390,7 +4393,7 @@
 "                          using g:netrw_compress_suffix to know which to
 "                          do.  By default:
 "                            g:netrw_compress        = "gzip"
-"                            g:netrw_decompress      = { ".gz" : "gunzip" , ".bz2" : "bunzip2" , ".zip" : "unzip" , ".tar" : "tar -xf"}
+"                            g:netrw_decompress      = { ".gz" : "gunzip" , ".bz2" : "bunzip2" , ".xz" : "unxz", ".zip" : "unzip" , ".tar" : "tar -xf"}
 fun! s:NetrwMarkFileCompress(islocal)
 "  call Dfunc("s:NetrwMarkFileCompress(islocal=".a:islocal.")")
   let svpos    = netrw#NetrwSavePosn()
@@ -7868,7 +7871,7 @@
   if a:fname != ""
    if a:fname =~ '\.[^./]\+$'
 "    call Decho("using fname<".a:fname.">'s suffix")
-    if a:fname =~ '.tar.gz' || a:fname =~ '.tar.bz2'
+    if a:fname =~ '.tar.gz' || a:fname =~ '.tar.bz2' || a:fname =~ '.tar.xz'
      let suffix = ".tar".substitute(a:fname,'^.*\(\.[^./]\+\)$','\1','e')
     else
      let suffix = substitute(a:fname,'^.*\(\.[^./]\+\)$','\1','e')
diff -uNr vim72/autoload/tar.vim vim72-xz/autoload/tar.vim
--- vim72/autoload/tar.vim	2010-05-16 22:33:59.000000000 +0200
+++ vim72-xz/autoload/tar.vim	2010-05-16 22:43:47.552260967 +0200
@@ -164,6 +164,9 @@
   elseif tarfile =~# '\.lzma$'
 "   call Decho("3: exe silent r! lzma -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ")
    exe "silent r! lzma -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
+  elseif tarfile =~# '\.xz$'
+"   call Decho("3: exe silent r! xz -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - ")
+   exe "silent r! xz -d -c -- ".shellescape(tarfile,1)." | ".g:tar_cmd." -".g:tar_browseoptions." - "
   else
    if tarfile =~ '^\s*-'
     " A file name starting with a dash is taken as an option.  Prepend ./ to avoid that.
@@ -265,10 +268,13 @@
   elseif  fname =~ '\.lzma$' && executable("lzcat")
    let decmp= "|lzcat"
    let doro = 1
+  elseif  fname =~ '\.xz$' && executable("xzcat")
+   let decmp= "|xzcat"
+   let doro = 1
   else
    let decmp=""
    let doro = 0
-   if fname =~ '\.bz2$\|\.gz$\|\.lzma$\|\.zip$\|\.Z$'
+   if fname =~ '\.bz2$\|\.gz$\|\.lzma$\|\.xz$\|\.zip$\|\.Z$'
     setlocal bin
    endif
   endif
@@ -290,6 +296,9 @@
   elseif tarfile =~# '\.lzma$'
 "   call Decho("7: exe silent r! lzma -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp)
    exe "silent r! lzma -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
+  elseif tarfile =~# '\.xz$'
+"   call Decho("7: exe silent r! xz -d -c ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp)
+   exe "silent r! xz -d -c -- ".shellescape(tarfile,1)."| ".g:tar_cmd." -".g:tar_readoptions." - ".tar_secure.shellescape(fname,1).decmp
   else
    if tarfile =~ '^\s*-'
     " A file name starting with a dash is taken as an option.  Prepend ./ to avoid that.
@@ -393,6 +402,11 @@
    let tarfile = substitute(tarfile,'\.lzma','','e')
    let compress= "lzma -- ".shellescape(tarfile,0)
 "   call Decho("compress<".compress.">")
+  elseif tarfile =~# '\.xz'
+   call system("xz -d -- ".shellescape(tarfile,0))
+   let tarfile = substitute(tarfile,'\.xz','','e')
+   let compress= "xz -- ".shellescape(tarfile,0)
+"   call Decho("compress<".compress.">")
   elseif tarfile =~# '\.tgz'
    call system("gzip -d -- ".shellescape(tarfile,0))
    let tarfile = substitute(tarfile,'\.tgz','.tar','e')
diff -uNr vim72/autoload/vimball.vim vim72-xz/autoload/vimball.vim
--- vim72/autoload/vimball.vim	2010-05-16 22:33:59.000000000 +0200
+++ vim72-xz/autoload/vimball.vim	2010-05-16 22:45:32.614510143 +0200
@@ -505,6 +505,26 @@
    exe "e ".escape(fname,' \')
    if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif
 
+  elseif expand("%") =~ '.*\.xz' && executable("unxz")
+   " handle *.xz with unxz
+   silent exe "!unxz ".shellescape(a:fname)
+   if v:shell_error != 0
+	call vimball#ShowMesg(s:WARNING,"(vimball#Decompress) unxz may have failed with <".a:fname.">")
+   endif
+   let fname= substitute(a:fname,'\.xz$','','')
+   exe "e ".escape(fname,' \')
+   if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif
+
+  elseif expand("%") =~ '.*\.xz' && executable("xz")
+   " handle *.xz with xz -d
+   silent exe "!xz -d ".shellescape(a:fname)
+   if v:shell_error != 0
+	call vimball#ShowMesg(s:WARNING,'(vimball#Decompress) "xz -d" may have failed with <'.a:fname.">")
+   endif
+   let fname= substitute(a:fname,'\.xz$','','')
+   exe "e ".escape(fname,' \')
+   if a:0 == 0| call vimball#ShowMesg(s:USAGE,"Source this file to extract it! (:so %)") | endif
+
   elseif expand("%") =~ '.*\.zip' && executable("unzip")
    " handle *.zip with unzip
    silent exe "!unzip ".shellescape(a:fname)
diff -uNr vim72/filetype.vim vim72-xz/filetype.vim
--- vim72/filetype.vim	2010-05-16 22:34:09.000000000 +0200
+++ vim72-xz/filetype.vim	2010-05-16 22:47:29.343285870 +0200
@@ -37,7 +37,7 @@
 " Pattern used to match file names which should not be inspected.
 " Currently finds compressed files.
 if !exists("g:ft_ignore_pat")
-  let g:ft_ignore_pat = '\.\(Z\|gz\|bz2\|zip\|tgz\)$'
+  let g:ft_ignore_pat = '\.\(Z\|gz\|bz2\|xz\|zip\|tgz\)$'
 endif
 
 " Function used for patterns that end in a star: don't set the filetype if the
diff -uNr vim72/plugin/tarPlugin.vim vim72-xz/plugin/tarPlugin.vim
--- vim72/plugin/tarPlugin.vim	2010-05-16 22:33:59.000000000 +0200
+++ vim72-xz/plugin/tarPlugin.vim	2010-05-16 22:46:39.220270785 +0200
@@ -39,8 +39,9 @@
   au BufReadCmd   *.lrp			call tar#Browse(expand("<amatch>"))
   au BufReadCmd   *.tar.bz2		call tar#Browse(expand("<amatch>"))
   au BufReadCmd   *.tar.Z		call tar#Browse(expand("<amatch>"))
+  au BufReadCmd   *.tar.lzma	        call tar#Browse(expand("<amatch>"))
+  au BufReadCmd   *.tar.xz		call tar#Browse(expand("<amatch>"))
   au BufReadCmd   *.tgz			call tar#Browse(expand("<amatch>"))
-  au BufReadCmd   *.tar.lzma	call tar#Browse(expand("<amatch>"))
 augroup END
 com! -nargs=? -complete=file Vimuntar call tar#Vimuntar(<q-args>)
 
diff -uNr vim72/plugin/vimballPlugin.vim vim72-xz/plugin/vimballPlugin.vim
--- vim72/plugin/vimballPlugin.vim	2010-05-16 22:33:59.000000000 +0200
+++ vim72-xz/plugin/vimballPlugin.vim	2010-05-16 22:47:07.425260844 +0200
@@ -26,8 +26,8 @@
 com! -na=? -complete=dir  UseVimball			call vimball#Vimball(1,<f-args>)
 com! -na=0                VimballList			call vimball#Vimball(0)
 com! -na=* -complete=dir  RmVimball				call vimball#SaveSettings()|call vimball#RmVimball(<f-args>)|call vimball#RestoreSettings()
-au SourceCmd  *.vba.gz,*.vba.bz2,*.vba.zip		call vimball#Decompress(expand("<amatch>"))|call vimball#Vimball(1)
-au BufEnter  *.vba,*.vba.gz,*.vba.bz2,*.vba.zip	setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff != 'unix'| setlocal ma ff=unix noma |endif|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)")
+au SourceCmd  *.vba.gz,*.vba.bz2,*.vba.xz,*.vba.zip		call vimball#Decompress(expand("<amatch>"))|call vimball#Vimball(1)
+au BufEnter  *.vba,*.vba.gz,*.vba.bz2,*.vba.xz,*.vba.zip	setlocal bt=nofile fmr=[[[,]]] fdm=marker|if &ff != 'unix'| setlocal ma ff=unix noma |endif|call vimball#ShowMesg(0,"Source this file to extract it! (:so %)")
 
 " =====================================================================
 " Restoration And Modelines: {{{1