From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14691 invoked from network); 14 Apr 2005 13:47:25 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 14 Apr 2005 13:47:25 -0000 Received: (qmail 81737 invoked from network); 14 Apr 2005 13:47:20 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 14 Apr 2005 13:47:19 -0000 Received: (qmail 15564 invoked by alias); 14 Apr 2005 13:47:17 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21139 Received: (qmail 15553 invoked from network); 14 Apr 2005 13:47:16 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 14 Apr 2005 13:47:16 -0000 Received: (qmail 81468 invoked from network); 14 Apr 2005 13:47:16 -0000 Received: from pat.uio.no (129.240.130.16) by a.mx.sunsite.dk with SMTP; 14 Apr 2005 13:47:12 -0000 Received: from mail-mx1.uio.no ([129.240.10.29]) by pat.uio.no with esmtp (Exim 4.43) id 1DM4gZ-0000dL-L1 for zsh-workers@sunsite.dk; Thu, 14 Apr 2005 15:47:11 +0200 Received: from 115.80-203-46.nextgentel.com ([80.203.46.115] helo=s.hn.org) by mail-mx1.uio.no with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.43) id 1DM4gW-0008Ay-J6 for zsh-workers@sunsite.dk; Thu, 14 Apr 2005 15:47:08 +0200 Received: (qmail 8553 invoked by uid 1000); 14 Apr 2005 13:47:03 -0000 Date: Thu, 14 Apr 2005 15:47:03 +0200 From: Haakon Riiser To: zsh-workers@sunsite.dk Subject: Updated _acroread completer Message-ID: <20050414134703.GA7862@s> Mail-Followup-To: zsh-workers@sunsite.dk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.9i X-UiO-Spam-info: not spam, SpamAssassin (score=-3.544, required 12, autolearn=disabled, AWL 1.41, FORGED_RCVD_HELO 0.05, UIO_MAIL_IS_INTERNAL -5.00) X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.6 required=6.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 I just wrote an updated version of _acroread that works for both acroread 5 and 7. Unfortunately, determining the version number involves running acroread -help, which is a bit slow. I was thinking about caching the version number, but I'm not sure what's the recommended way of doing that. Is it OK if I just set a non- local variable _acroread_version? Anyway, here's what I got so far: #------------------------------------------------------------------------------# #compdef acroread local curcontext="$curcontext" state line # The output of acroread -version cannot be piped to stdout for some reason, so # the version number must be read from ACROREAD-PREFIX/Reader/AcroVersion. # Since acroread might have been started via a wrapper script, the only # failsafe way of determining ACROREAD-PREFIX is to look at the output of # acroread -help. TODO: running acroread -help is slow - can version be cached # for a single shell session? local acropath=${${(s. .)${${(f)"$($words[1] -help 2>&1)"}[1]}}[2]} local version=$(< ${acropath%/*}/../Reader/AcroVersion) if [[ $version == 7.* ]]; then _arguments -C \ '--display=:X display:_x_display' \ '--screen=:X screen (overrides the screen part of DISPLAY)' \ --sync \ '-geometry:[x][{+|-}{+|-}]' \ -help \ -iconic \ '*-setenv:=' \ -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:=' \ -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 #------------------------------------------------------------------------------# -- Haakon