about summary refs log tree commit diff
path: root/Completion/X
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/X')
-rw-r--r--Completion/X/Command/_acroread123
1 files changed, 87 insertions, 36 deletions
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