From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3273 invoked from network); 10 Jan 2002 10:57:49 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 10 Jan 2002 10:57:49 -0000 Received: (qmail 26876 invoked by alias); 10 Jan 2002 10:57:38 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 16426 Received: (qmail 26865 invoked from network); 10 Jan 2002 10:57:38 -0000 From: Sven Wischnowsky MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15421.29507.805814.495530@wischnow.berkom.de> Date: Thu, 10 Jan 2002 11:56:03 +0100 To: zsh-workers@sunsite.dk Subject: Re: man page completion (was Re: Few newbie questions..) In-Reply-To: <3B823339.BFD4B63C@yahoo.co.uk> References: <20010817173924.73063.qmail@web20304.mail.yahoo.com> <3B823339.BFD4B63C@yahoo.co.uk> X-Mailer: VM 6.95 under 21.5 (patch 3) "asparagus" XEmacs Lucid Ages ago, Oliver Kiddle wrote: > ... > > Having the section number visible is a useful idea which I'd also like. > Putting it in the actual match is not ideal though. It would be better > to have the section number in a description or to group different > sections separately under different headings. > > I expect some people would prefer not to have this separate grouping. > `zstyle ':completion:*:man.*' group-name manual' might group them all > together but you would then still get separate headings for each group > and I'm not sure if it is possible to replace them with one. It would > also allow other things like use of the tag-order style. I seem to have missed this, otherwise I'd have implemented it. Here is a patch, using a new style `separate-sections' to select if the sections should be added separately at all. Defaults to `false' for backward compatibility. Hence I'm going to commit this. Bye Sven Index: Completion/Unix/Command/_man =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_man,v retrieving revision 1.4 diff -u -r1.4 _man --- Completion/Unix/Command/_man 2001/08/21 18:06:25 1.4 +++ Completion/Unix/Command/_man 2002/01/10 10:54:52 @@ -40,8 +40,28 @@ dirs=( $^manpath/(sman|man|cat)*/ ) awk='{print $1}' fi + if zstyle -t ":completion:${curcontext}:manuals" separate-sections; then + typeset -U sects + local ret=1 - _wanted manuals expl 'manual page' _man_pages + sects=( ${(o)${dirs##*(man|cat)}%/} ) + + (( $#sects )) || return 1 + + _tags manuals.${^sects} + while _tags; do + for sect in $sects; do + _requested manuals.$sect expl "manual page, section $sect" _man_pages && + ret=0 + done + (( ret )) || return 0 + done + + return 1 + else + sect= + _wanted manuals expl 'manual page' _man_pages + fi } _man_pages() { @@ -56,7 +76,7 @@ matcher= fi - pages=( $dirs ) + pages=( ${(M)dirs:#*$sect/} ) compfiles -p pages '' '' "$matcher" '' dummy '*' pages=( ${^~pages}(N:t:r) ) Index: Completion/Zsh/Command/_zstyle =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Command/_zstyle,v retrieving revision 1.5 diff -u -r1.5 _zstyle --- Completion/Zsh/Command/_zstyle 2002/01/04 12:09:31 1.5 +++ Completion/Zsh/Command/_zstyle 2002/01/10 10:54:53 @@ -100,6 +100,7 @@ remove-all-dups c:bool select-prompt c: select-scroll c: + separate-sections c:bool single-ignored c:single-ignored sort c:bool special-dirs c:sdirs Index: Doc/Zsh/compsys.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v retrieving revision 1.138 diff -u -r1.138 compsys.yo --- Doc/Zsh/compsys.yo 2002/01/04 12:09:31 1.138 +++ Doc/Zsh/compsys.yo 2002/01/10 10:54:53 @@ -1971,6 +1971,15 @@ that number (or plus the number, since it is negative). The default is to scroll by single lines. ) +kindex(separate-sections, completion style) +item(tt(separate-sections))( +This style is used with the tt(manuals) tag when completing names of +manual pages. If it is `true', entries for different sections are +added separately using tag names of the form `tt(manual.)var(X)', +where var(X) is the section number. This means that it is possible to +make pages from different sections be listed separately by setting the +tt(group-name) style. The default for this style is `false'. +) kindex(single-ignored, completion style) item(tt(single-ignored))( This is used by the tt(_ignored) completer. It specifies what -- Sven Wischnowsky wischnow@berkom.de