about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2005-05-10 12:26:24 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2005-05-10 12:26:24 +0000
commitcb06c06315086ede1ecd83b29bce5cf8958b1e40 (patch)
treeaa14cf33e6dfa021385d1431c88383419cd19ede
parentd0a12b9d7bf8794c1fd4b490501ee167aa62b511 (diff)
downloadzsh-cb06c06315086ede1ecd83b29bce5cf8958b1e40.tar.gz
zsh-cb06c06315086ede1ecd83b29bce5cf8958b1e40.tar.xz
zsh-cb06c06315086ede1ecd83b29bce5cf8958b1e40.zip
Haakon Riiser: 21188: handle acroread 7.x
-rw-r--r--ChangeLog6
-rw-r--r--Completion/X/Command/_acroread123
2 files changed, 93 insertions, 36 deletions
diff --git a/ChangeLog b/ChangeLog
index d4df77737..e2024e9ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-05-10  Oliver Kiddle  <opk@zsh.org>
+
+	* Haakon Riiser: 21188: Completion/X/Command/_acroread: handle
+	acroread 7.x
+
 2005-05-09  Bart Schaefer  <schaefer@zsh.org>
 
 	* unposted (see 21240): Functions/Prompts/prompt_bart_setup,
@@ -122,6 +127,7 @@
 	dpkg-reconfigure completion.
 
 2005-04-18  Felix Rosencrantz <f_rosencrantz@gmail.com>
+
 	* 21154: Completion/Unix/Command/_perforce: add pid completion for
 	monitor (clear|terminate) commands.
 
diff --git a/Completion/X/Command/_acroread b/Completion/X/Command/_acroread
index 41c6b99f4..afcd3188c 100644
--- a/Completion/X/Command/_acroread
+++ b/Completion/X/Command/_acroread
@@ -2,42 +2,93 @@
 
 local curcontext="$curcontext" state line
 
-_x_arguments -C \
-  -help \
-  -helpall \
-  \*-iconic \
-  \*+iconic \
-  '-name:application name:_x_name' \
-  '*-setenv:<var>=<value>' \
-  -tempFile \
-  '-tempFileTitle:title' \
-  '(+useFrontEndProgram)-useFrontEndProgram' \
-  '(-useFrontEndProgram)+useFrontEndProgram' \
-  '-visual:X visual:_x_visual' \
-  '-xrm:X resource specification:_x_resource' \
-  '-toPostScript:*::PostScript conversion options:= ->tops' \
-  '*:PDF file:_files -g "*.(#i)pdf(-.)"' && return
+# Try extracting the version number directly from the executable.
+# (This will fail if the executable is a wrapper script for acroread.)
+local ver=${${${(f)"$(<$commands[$words[1]])"}:#^ver=*}##ver=}
+[[ -n $ver ]] && _acroread_version=$ver
 
-[[ -n "$state" ]] && _arguments \
-  '-pairs:*:pdf_file_1 ps_file_1 ...:_files -g "*.(#i)(pdf|ps)(-.)"' \
-  -binary \
-  '-start:integer' \
-  '-end:integer' \
-  -optimizeForSpeed \
-  -landscape \
-  -reverse \
-  '(-even)-odd' \
-  '(-odd)-even' \
-  -commentsOff \
-  '(-level2 -level3)-level1' \
-  '(-level1 -level3)-level2' \
-  '(-level1 -level2)-level3' \
-  -printerhalftones \
-  -saveVM \
-  '-scale:integer' \
-  -shrink \
-  '-size:page size (or custom size wxh in points):(letter tabloid ledger legal executive a3 a4 a5 b4 b5)' \
-  '-transQuality:transparency flattening level:(1 2 3 4 5)' \
-  '*:PDF file:_files -g "*.(#i)pdf(-.)"' && return
+if (( ! $+_acroread_version )); then
+  local acropath=${${(s. .)${${(f)"$($words[1] -help 2>&1)"}[1]}}[2]}
+  _acroread_version=${${${(f)"$(<$acropath)"}:#^ver=*}##ver=}
+fi
+
+if [[ $_acroread_version == 7.* ]]; then
+  _arguments -C \
+    '--display=:X display:_x_display' \
+    '--screen=:X screen (overrides the screen part of DISPLAY)' \
+    --sync \
+    '-geometry:[<width>x<height>][{+|-}<x offset>{+|-}<y offset>]' \
+    -help \
+    -iconic \
+    '*-setenv:<var>=<value>' \
+    -tempFile \
+    '-tempFileTitle:title' \
+    -openInNewWindow \
+    -version \
+    '-visual:X visual:_x_visual' \
+    '-toPostScript:*::PostScript conversion options:= ->tops' \
+    '*:PDF file:_files -g "*.(#i)pdf(-.)"' && return
+
+  [[ -n "$state" ]] && _arguments \
+    '-pairs:*:pdf_file_1 ps_file_1 ...:_files -g "*.(#i)(pdf|ps)(-.)"' \
+    -binary \
+    '-start:integer' \
+    '-end:integer' \
+    -optimizeForSpeed \
+    -landscape \
+    -reverse \
+    '(-even)-odd' \
+    '(-odd)-even' \
+    -commentsOff \
+    -annotsOff \
+    '(-level3)-level2' \
+    '(-level2)-level3' \
+    -printerhalftones \
+    -saveVM \
+    '-scale:integer' \
+    -shrink \
+    -expand \
+    '-size:page size (or custom size wxh in points):(letter tabloid ledger legal executive a3 a4 a5 b4 b5)' \
+    '-transQuality:transparency flattening level:(1 2 3 4 5)' \
+    '*:PDF file:_files -g "*.(#i)pdf(-.)"' && return
+else
+  _x_arguments -C \
+    -help \
+    -helpall \
+    \*-iconic \
+    \*+iconic \
+    '-name:application name:_x_name' \
+    '*-setenv:<var>=<value>' \
+    -tempFile \
+    '-tempFileTitle:title' \
+    '(+useFrontEndProgram)-useFrontEndProgram' \
+    '(-useFrontEndProgram)+useFrontEndProgram' \
+    '-visual:X visual:_x_visual' \
+    '-xrm:X resource specification:_x_resource' \
+    '-toPostScript:*::PostScript conversion options:= ->tops' \
+    '*:PDF file:_files -g "*.(#i)pdf(-.)"' && return
+
+  [[ -n "$state" ]] && _arguments \
+    '-pairs:*:pdf_file_1 ps_file_1 ...:_files -g "*.(#i)(pdf|ps)(-.)"' \
+    -binary \
+    '-start:integer' \
+    '-end:integer' \
+    -optimizeForSpeed \
+    -landscape \
+    -reverse \
+    '(-even)-odd' \
+    '(-odd)-even' \
+    -commentsOff \
+    '(-level2 -level3)-level1' \
+    '(-level1 -level3)-level2' \
+    '(-level1 -level2)-level3' \
+    -printerhalftones \
+    -saveVM \
+    '-scale:integer' \
+    -shrink \
+    '-size:page size (or custom size wxh in points):(letter tabloid ledger legal executive a3 a4 a5 b4 b5)' \
+    '-transQuality:transparency flattening level:(1 2 3 4 5)' \
+    '*:PDF file:_files -g "*.(#i)pdf(-.)"' && return
+fi
 
 return 1