From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17263 invoked by alias); 10 Jun 2018 13:08:02 -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: 42979 Received: (qmail 18103 invoked by uid 1010); 10 Jun 2018 13:08:02 -0000 X-Qmail-Scanner-Diagnostics: from park01.gkg.net 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(205.235.26.22):SA:0(-1.4/5.0):. Processed in 1.780775 secs); 10 Jun 2018 13:08:02 -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.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_PASS,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.1 X-Envelope-From: SRS0=FKr/=I4=yahoo.co.uk=okiddle@bounces.park01.gkg.net X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Virus-Scanned: by amavisd-new at gkg.net Authentication-Results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1528636057; bh=98s1dHBiy42qjFgztLn5Kq7KeNEl3XdA4gTkd9ev+IE=; h=From:References:To:Subject:Date:From:Subject; b=TBCy5aasXtmJAMDyjTS0c+EHxOuEmf5GOVMq/8Mg5UZ9JqCj/ITPxRqI+3TAyMtRe25DGuphxWxeOS8PYa2xVJ1hWtRQXYCsSHNhXrymEoJGSGwm7E+hhg3AR3ld0ICG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2YW6zypalfF4Z5HxX_c3her_HvhyWVfsuWY_Fl54Ya3QI hTiDoNmFIaH45t6QDVDApEXHFX.KoFtVX.LdBzQtEshgha56C16uAjbZTTMTZyjnm9yzCCOmty28 YVcoz6CL_7lnoFWt07cWkYcmuyj6q0Y2q7d6Xx3PusdNGBo_STLAst0slUAF7vEEAFfefFof8EjM EAa_.3zmffTo2cg-- cc: Zsh workers In-reply-to: <9B2A476B-3C9F-4757-9818-4815A9417253@dana.is> From: Oliver Kiddle References: <9B2A476B-3C9F-4757-9818-4815A9417253@dana.is> To: dana Subject: Re: [PATCH] Completion: Improve _man MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <17922.1528636054.1@thecus> Date: Sun, 10 Jun 2018 15:07:34 +0200 Message-ID: <17923.1528636054@thecus> dana wrote: > Here's a *much* more complicated change. It enhances _man as follows: This looks like a big improvement, thanks. > * Complete all options to most major man variants > * More accurately match sections > * Better handle certain edge cases (see below) > * Show descriptions for sections (suggested by Mikael i think) Those look useful. > Notes: > > * The function would previously use the provided section name as the leading > part of a directory pattern, so that on Solaris for example if you gave it 3p > it would also complete pages from 3pool, 3proc, &c. I couldn't think of a > reason this functionality would be desirable (man won't show you a page from a > section it's not in anyway), so i made it match exactly Is this the line where you removed * from: dirs=( $^_manpath/(sman|man|cat)${^sects}*/ ) I think I've seen systems with directories named man1.Z/cat1.Z etc. HP/UX perhaps. Perhaps also locales have occured such as man3f.fi_FI I suspect the * was to handle something like that rather than for the undesirable functionality you describe. > * I chose sections to describe pretty arbitrarily. Solaris variants have 9034234 > different sections and i didn't want to enumerate every single one, but some I'm only seeing 270 sections, still too many to start enumerating them. It looks like the sections will be changing with Solaris 11.4: https://blogs.oracle.com/solaris/normalizing-man-page-section-numbers-in-solaris-114-v2 > of them seem like they might come up a lot in regular use. It may be nice in > the future to give separate tags to the described and undescribed ones, so > that navigation is a little nicer for people with `group-name ''` Am not so sure about that. Navigation seemed fine without. And _describe doesn't currently support a mix of tags. > * Could someone please review the way i return from _arguments? I don't think > it's correct (because it doesn't account for prefix-needed?), but i've been > looking at this for too long Indeed, with the prefix-needed style set, _arguments adds the options and then we should also add man pages in the state. (I use this with _approximate to handle mistakes in the prefix itself). As it is, by doing a return, the function ends before the state can be handled. Usually, this is solved with a ret variable, but care would be needed not to disturb the existing ret variable used later in the function. A lazy alternative is to use $compstate[nmatches] > I've tested this on several different platforms, but it's still a pretty major > alteration to a function that i imagine sees a lot of traffic, so i'm a little > nervous about it. If someone else could try it out that might be a good idea For the most part, this looks great. I'll push it as-is for now. Any further tweaks can then be done as incrementals diffs. > + '(-X --gxditview)'{-X-,--gxditview=-}'[display output in gxditview using specified DPI (default: 75)]::DPI' It's a minor thing but I find it more useful to put hints on the arguments (units, defaults) etc in the heading for them. '(-X --gxditview)'{-X-,--gxditview=-}'[display output in gxditview optionally using specified resolution]::resolution (DPI) [75]' > + [[ $state == sects ]] && { > + local s > + local -a specs > + > + (( $#sects )) || { > + _message 'manual section' This should use _message -e and a tag so that it honours the user's setting of the format style with the descriptions tag. And, to allow the user to add some matches with the fake style. > + return 1 > + } > + > + # Build specs from descriptions > + for s in $sects; do > + specs+=( "${s}[${(b)sect_descs[$s]}]" ) > + done This results in all sections for which we don't have a description getting an empty description. The descriptions that we have are then pushed right over to the right like this: 3zonestat 5openssl 5oldap 4b 7openssl 8oldap 7ipp -- 1openssl -- OpenSSL commands 1t -- Tcl/Tk features Try: _values x {a,b,c,d,e,f}'[]' 'g[description]' vs. _values x {a,b,c,d,e,f} 'g[description]' I'd suggest using _sequence wrapping _describe instead. Initialise sect_descs in _describe format to begin with and then it can be filtered like this: sect_descs=( 1:one 2:two ) sects=( 1 2 3 4 ) remove=( ${sect_descs%%:*} ) sect_descs+=( ${sects:|remove} ) _describe also makes it easier to apply a more useful tag than just values which can match the one from _message -e mentioned above. Oliver