From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14517 invoked by alias); 11 Jun 2018 10:48:38 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 42983 Received: (qmail 12073 invoked by uid 1010); 11 Jun 2018 10:48:38 -0000 X-Qmail-Scanner-Diagnostics: from mail-it0-f67.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.214.67):SA:0(-1.9/5.0):. Processed in 1.461928 secs); 11 Jun 2018 10:48:38 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS,T_DKIMWL_WL_MED,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: dana@dana.is X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dana-is.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ndLHmSoD5djVDsDZAzWE3WfXErbWkc/9Jq2t5t9IbI0=; b=i17u000RklDSJITMtr42e5glmeqNn109h73Yyy9BZAim7A3pk2h34lqTx1fAR77ZAX xYKx+ERN/IIj/NYO997HJN9F0VC+mknB+MLSzOHXw7/lWNJoqGgropx/jwSgTA1SNA8V QAoYVjQuxI0faqrijw5O2ke4eXzakbjeWkFUxPKm0mWZGpdMJdthGHYx/htQ9jhAvx2W DLP8rtz4Wn1Soyd8/LpOG9Z+WwlZvl3QA6bNCPUWzDZty+5MlKFeZFi+KeWIU/f2w3tB H9TXTwK/SKbxarrzzZMskbqF8eBg/b9sHgqJWFgV0esGjU0F07zoQv5c+pK9/+fE2loS RcaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ndLHmSoD5djVDsDZAzWE3WfXErbWkc/9Jq2t5t9IbI0=; b=eeil/Zyp86D2uSWLLPWo0mF1jC1krCgCe6ZHpDmduShosDJLHJN4vgQFTovt+wv8hr lpEyeaUYp/u5F0adsQs26m2j+MhZWeh6nijW3kf8aOvXrpP5tixujB4aEApps1qy1gc+ Y87kT3c6KruoetJO7imxx4ItgDmmn/pbP2Yeul77SXFkkLdzsFOSnh7w+XFDZvf6N4wi gE/rANGZt/m3aEUxrzOmwyTDNROtQOOw7PXQ5ipinYorc0HqzinPq5j3uk8ILVaJ2XTG KNkfpCELPNitSfd7QEwBfM4OGcQqp+3Daclm2R7hnQyPcJyohXdkBwOAdGATPGqFiLv+ PVdQ== X-Gm-Message-State: APt69E36Cr/wE1ttQrQBUKPRvTptsa77xgtwwi5pLLs7k4U8vIa/YT02 Qyy2ufwyNCNi/hZY47i4BlKi4hHDdcY= X-Google-Smtp-Source: ADUXVKKVRAnnHVubHfHcBdwr/pP1yjOTpVP0KqgbkBjIxIoesYy9Jhgb9htL9wkJpPLyBpR+EI01kQ== X-Received: by 2002:a24:52cb:: with SMTP id d194-v6mr10921203itb.46.1528714114501; Mon, 11 Jun 2018 03:48:34 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: [PATCH] Completion: Improve _man (2) From: dana In-Reply-To: Date: Mon, 11 Jun 2018 05:48:33 -0500 Cc: Oliver Kiddle Content-Transfer-Encoding: quoted-printable Message-Id: <2BD8008C-D6F4-4B4A-AF05-7EE80ADB0E47@dana.is> References: <9B2A476B-3C9F-4757-9818-4815A9417253@dana.is> <17923.1528636054@thecus> To: Zsh workers X-Mailer: Apple Mail (2.3445.6.18) Hi Oliver, Here are some fixes per your earlier feedback. I updated the section-directory glob to allow a compression/locale = 'extension'; as i said, i've never actually seen this myself, but your theory seems plausible, and it shouldn't hurt anything on other systems. I switched to _describe for completing sections, though i didn't use the = exact suggestion you gave because sect_descs is used farther down in the = function and i would have had to change stuff there as well. I did NOT change the _arguments return thing, because frankly i don't = really understand the expected results for that prefix-needed configuration, = and i didn't want to break anything down-function in my ignorance. :/ dana diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man index 4cba9d625..11c2fab7f 100644 --- a/Completion/Unix/Command/_man +++ b/Completion/Unix/Command/_man @@ -109,7 +109,7 @@ _man() { '--warnings=3D[enable specified groff warnings]:groff warnings' '(-a --all --regex)--wildcard[treat page name as shell glob]' # @todo Could enumerate these - '(-X --gxditview)'{-X-,--gxditview=3D-}'[display output in = gxditview using specified DPI (default: 75)]::DPI' + '(-X --gxditview)'{-X-,--gxditview=3D-}'[display output in = gxditview using specified DPI]::resolution (DPI) [75]' # @todo Post-process how? '(-t --troff -Z --ditroff)'{-Z,--ditroff}'[post-process output = for chosen device]' ) @@ -232,7 +232,7 @@ _man() { =20 if [[ $sect =3D (<->*|[lnopx]) || $sect =3D *\|* ]]; then sects=3D( ${(s.|.)sect} ) - dirs=3D( $^_manpath/(sman|man|cat)${^sects}/ ) + dirs=3D( $^_manpath/(sman|man|cat)${^sects}(|.*)/ ) sect=3D${(j<|>)sects} [[ $sect =3D=3D *'|'* ]] && sect=3D"($sect)" awk=3D"\$2 =3D=3D \"$sect\" {print \$1}" @@ -247,7 +247,7 @@ _man() { =20 # Solaris 11 and on have a man-index directory that doesn't contain = manpages dirs=3D( ${dirs:#*/man-index/} ) - sects=3D( ${(o)${dirs##*(man|cat)}%/} ) + sects=3D( ${(o)${${dirs##*(man|cat)}%.*}%/} ) =20 # If we've got this far, we can build our look-up table for = descriptions of # the more common sections. Unless otherwise labelled, the more = specific ones @@ -297,6 +297,11 @@ _man() { # Add OS-specific stuff that's too risky for or overrides the = general list [[ $OSTYPE =3D=3D darwin* ]] && sect_descs+=3D( n 'Tcl/Tk = features' ) [[ $OSTYPE =3D=3D openbsd* ]] && sect_descs+=3D( 3p 'Perl features' = ) + # @todo Oracle Solaris 11.4 adopts the BSD/Linux structure, making = many of + # these inaccurate =E2=80=94 this should be handled accordingly in = the future. If + # OSTYPE isn't helpful (since other Solaris descendants may not = follow + # suit), we could perhaps use the presence of SysV-style sections = under + # _manpath as the determinant [[ $OSTYPE =3D=3D solaris* ]] && sect_descs+=3D( 1t 'Tcl/Tk features' 3m 'mathematical library functions' @@ -320,21 +325,22 @@ _man() { local -a specs =20 (( $#sects )) || { - _message 'manual section' + _message -e sections 'manual section' return 1 } =20 # Build specs from descriptions for s in $sects; do - specs+=3D( "${s}[${(b)sect_descs[$s]}]" ) + specs+=3D( "${s}:${(b)sect_descs[$s]}" ) done + specs=3D( ${specs%:} ) =20 if [[ $variant =3D=3D (darwin|dragonfly|freebsd|linux)* ]]; then - _values -s : 'manual section' $specs + _sequence -s : _describe -t sections 'manual section' specs elif [[ $variant =3D=3D solaris* ]]; then - _values -s , 'manual section' $specs + _sequence -s , _describe -t sections 'manual section' specs else - _values 'manual section' $specs + _describe -t sections 'manual section' specs fi return }