From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4315 invoked from network); 19 May 2006 08:32:19 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,FORGED_RCVD_HELO autolearn=ham version=3.1.1 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 19 May 2006 08:32:19 -0000 Received: (qmail 92461 invoked from network); 19 May 2006 08:32:09 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 19 May 2006 08:32:09 -0000 Received: (qmail 11842 invoked by alias); 19 May 2006 08:32:02 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10282 Received: (qmail 11833 invoked from network); 19 May 2006 08:32:01 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 19 May 2006 08:32:01 -0000 Received: (qmail 91256 invoked from network); 19 May 2006 08:32:01 -0000 Received: from web25401.mail.ukl.yahoo.com (217.12.10.135) by a.mx.sunsite.dk with SMTP; 19 May 2006 08:31:59 -0000 Received: (qmail 74893 invoked by uid 60001); 19 May 2006 08:31:58 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.uk; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=YLhWuw0WI0MmPaeNYm+5gfcOn34QzJWqe5oxYkKwLH+2vmsdaheLRJvS/L5wu+FENYJBD4KdIrWlrpPh8Amv0ziK5nMqXmzc/QCYBu3kqovll2A11V2cDLEX9mg/lV9SpNZWOjup24CwybCW7V1i377o/s2u5mI1phzVZJV7smg= ; Message-ID: <20060519083158.74891.qmail@web25401.mail.ukl.yahoo.com> Received: from [192.171.3.126] by web25401.mail.ukl.yahoo.com via HTTP; Fri, 19 May 2006 09:31:58 BST Date: Fri, 19 May 2006 09:31:58 +0100 (BST) From: Oliver Kiddle Subject: Re: menuselection with manpages To: zsh users MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="0-1953526486-1148027518=:71787" Content-Transfer-Encoding: 8bit --0-1953526486-1148027518=:71787 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Content-Id: Content-Disposition: inline Frank Terbeck wrote: > > How would I get the completion to add the section to the completion, > > like 'man 5 crontab'? > I found some time this evening, so I played around with the _man > function a little bit. The required change was pretty simple: Very nice! This should be configurable with a style. I've attached a patch which does that. This also means that section 1 can be excluded as follows: zstyle ':completion:*:manuals.(^1*)' insert-sections true I prefer this, especially on Solaris because there the prefix needs to include the -s option and that is then a common prefix to all matches. Oliver PS. Sorry for seperately attaching the patch but otherwise Yahoo's webmail would wrap the lines. Send instant messages to your online friends http://uk.messenger.yahoo.com --0-1953526486-1148027518=:71787 Content-Type: text/x-patch; name="mansect.patch" Content-Description: 817113010-mansect.patch Content-Disposition: inline; filename="mansect.patch" --- _man.orig Fri May 19 09:55:05 2006 +++ _man Fri May 19 10:24:10 2006 @@ -28,7 +28,7 @@ local sect if [[ $OSTYPE = solaris* ]]; then - sect=$words[$words[(i)-s]+1] + sect=${${words[(R)-s*]#-s}:-$words[$words[(i)-s]+1]} elif [[ -n ${sect:=$words[$words[(i)-S]+1]} || -n ${sect:=$MANSECT} ]]; then if [[ $sect != ${sect::="${sect//:/|}"} ]]; then sect="($sect)" @@ -44,7 +44,11 @@ dirs=( $^_manpath/(sman|man|cat)*/ ) awk='{print $1}' fi - if zstyle -t ":completion:${curcontext}:manuals" separate-sections; then + if [[ $OSTYPE = solaris* && ( $words[CURRENT] = -s* || $words[CURRENT-1] == -s ) ]]; then + [[ $words[CURRENT] = -s* ]] && compset -P '-s' + sects=( ${(o)${dirs##*(man|cat)}%/} ) + _wanted sections expl 'section' compadd -a sects + elif zstyle -t ":completion:${curcontext}:manuals" separate-sections; then typeset -U sects local ret=1 @@ -69,7 +73,7 @@ } _man_pages() { - local matcher pages dummy + local matcher pages dummy sopt zparseopts -E M+:=matcher @@ -90,7 +94,14 @@ # beginning with .<->: that handles problem cases like files called # `POSIX.1.5'. - compadd "$@" - ${pages%.(?|<->*(|.gz|.bz2|.Z))} + [[ $OSTYPE = solaris* ]] && sopt='-s ' + if ((CURRENT > 2)) || + ! zstyle -t ":completion:${curcontext}:manuals.$sect" insert-sections + then + compadd "$@" - ${pages%.(?|<->*(|.gz|.bz2|.Z))} + else + compadd "$@" -P "$sopt$sect " - ${pages%.(?|<->*(|.gz|.bz2|.Z))} + fi } _man "$@" --0-1953526486-1148027518=:71787--