Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: completion for compressed ps|pdf files for gv



Hi,

gv can read compressed .ps and .pdf files, and I use this
feature every days, unfortunately Zsh was not aware of this.
The suggested patch below adds the -z option to _ps and _pdf to
complete compressed files and modify _gv to use it.  (This is
also related to wich #56485 on the Debian bug tracking system.)

Question: is it really correct to suppress that `_wanted' call
in _pspdf (since _pdf will provide the description)?

Index: Completion/User/_gv
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_gv,v
retrieving revision 1.1.1.3
diff -u -u -r1.1.1.3 _gv
--- Completion/User/_gv	1999/09/07 12:55:06	1.1.1.3
+++ Completion/User/_gv	2000/08/23 07:27:56
@@ -36,4 +36,4 @@
   '-scalebase:scale base:' \
   '-ad:resource file:_files' \
   '-style:resource file:_files' \
-  '*:file:_pspdf'
+  '*:file: _pspdf -z'
Index: Completion/User/_pdf
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_pdf,v
retrieving revision 1.1.1.6
diff -u -u -r1.1.1.6 _pdf
--- Completion/User/_pdf	1999/12/01 15:29:44	1.1.1.6
+++ Completion/User/_pdf	2000/08/23 07:27:57
@@ -1,11 +1,13 @@
 #compdef acroread pdf2dsc pdf2ps pdfimages pdfinfo pdftopbm pdftops pdftotext xpdf
 
-local expl
+local expl ext=''
 
 # ghostscript:
 #  pdf2dsc pdf2ps
 # xpdf:
 #  pdfimages pdfinfo pdftopbm pdftops pdftotext xpdf
 
+[[ "$1" == '-z' ]] && ext='(|.gz|.Z)'
+
 _description files expl 'PDF file'
-_files "$expl[@]" -g '*.(#i)pdf'
+_files "$expl[@]" -g "*.(#i)pdf$ext"
Index: Completion/User/_ps
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_ps,v
retrieving revision 1.1.1.8
diff -u -u -r1.1.1.8 _ps
--- Completion/User/_ps	2000/02/13 03:53:36	1.1.1.8
+++ Completion/User/_ps	2000/08/23 07:27:57
@@ -1,9 +1,11 @@
 #compdef ps2epsi ps2pdf psmulti pswrap
 
-local expl
+local expl ext=''
 
 # ghostscript:
 #  ps2epsi ps2pdf
 
+[[ "$1" == '-z' ]] && ext='(|.gz|.Z)'
+
 _description files expl 'postscript file'
-_files "$expl[@]" -g '*.(#i)(ps|eps)'
+_files "$expl[@]" -g "*.(#i)(ps|eps)$ext"
Index: Completion/User/_pspdf
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_pspdf,v
retrieving revision 1.1.1.5
diff -u -u -r1.1.1.5 _pspdf
--- Completion/User/_pspdf	2000/03/24 00:01:57	1.1.1.5
+++ Completion/User/_pspdf	2000/08/23 07:27:57
@@ -5,7 +5,7 @@
 # ghostscript:
 #  gs gsbj gsdj gsdj500 gslj gslp gsnd ps2ascii
 
-_ps && ret=0
-_wanted files expl 'PDF file' _path_files -g '*.(#i)pdf'
+_ps "$@" && ret=0
+_pdf "$@"
 
 return ret

-- 
Alexandre Duret-Lutz



Messages sorted by: Reverse Date, Date, Thread, Author