From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10485 invoked by alias); 10 Jun 2018 06:06:30 -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: 42977 Received: (qmail 3935 invoked by uid 1010); 10 Jun 2018 06:06:30 -0000 X-Qmail-Scanner-Diagnostics: from mail-io0-f171.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.223.171):SA:0(-2.7/5.0):. Processed in 2.443687 secs); 10 Jun 2018 06:06:30 -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=-2.7 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,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=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=UGXRMSCJkZ4c0/m1aesy9rtlcOoVt5UkJZ5Z66z1XoA=; b=eHC9FyRqg4iCABm3c3vXGO1dUkdFEmceLgeQK/Dw7Swf4c7lRAm8Xsd9bjUJ/PXoeW KW0s0wRn+AeiMptr7VCaqgDxxaQigiAX4J5UlJ2VMsl8D3PIC0JAgbaw51xGSL5wkqh2 UECVNSW6P845lOcaxCE4aHFaucWkJqX1p9SWi2hkmRoFDOCAtdKLrjM+gWYJZx6S56Ye AN/nxjD9ez8CgXNphsw+XZVkN8QBrPX9YMMYmo6aFqCB2HzdCgDW/zymC9vJEQxjO83Y j9HXv2/BuhEndVhl8PUQDIuGPbdEuwd1E7cozaE4TjOFW8e1kM4JLM38HZ4u9mO1W1fi jgsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:message-id:date:to; bh=UGXRMSCJkZ4c0/m1aesy9rtlcOoVt5UkJZ5Z66z1XoA=; b=aa+X0VhKmZuWaZ1btlUFG4Iueh6y1n6DOGCInbqZG6yT+mautrv+OdlEOYa5tuJomY PIAzsHeBqYd7o6OCt1l76Ljk4kdyujqm6OhKMB/JHmhXL8evjY220SU7D0fI2DUaElHp 4v3ml0LNhAwhLgL3u4PBC+5ZGD0krr7w54ji0A1JdvP2OSPLG2EaZyXszAiIEPM73+rl j6iFwEkqYxcCx6+Ti5c/9qdogcljE7ItG9sIvXDGHayWWS1q3hAlzrwU3HPZl3VMwoEZ kmI6Puvp/zhDrAXupMN5SqN1OletOxHAfvnPz3P/d2pyjoBwY5Yj0HeuRK3GEeYnSlZO /Dfg== X-Gm-Message-State: APt69E1pXy5LS+BkYeBFxVwLR66hLXrvhcOIGK+Bikxy+azRClgZGy/a OeF10BSr5U+g59+hQM/ZqRpWuj1oDK4= X-Google-Smtp-Source: ADUXVKLJSa93oE2uAnYLFQV1l8hRZgRZXieUtVQH74s8nQMiiYFcxQlZ6KY04HbDVkWvWi8sQhciaQ== X-Received: by 2002:a6b:d30e:: with SMTP id s14-v6mr2569546iob.213.1528610784465; Sat, 09 Jun 2018 23:06:24 -0700 (PDT) From: dana Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [PATCH] Completion: Improve _man Message-Id: <9B2A476B-3C9F-4757-9818-4815A9417253@dana.is> Date: Sun, 10 Jun 2018 01:06:22 -0500 To: Zsh workers X-Mailer: Apple Mail (2.3273) Here's a *much* more complicated change. It enhances _man as follows: * 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) 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 * The function previously behaved kind of strangely when given multiple = operands (where the first one is potentially an unknown section name). For = example, if you do `man zz ` on macOS it just keeps completing the word = 'fuzzy' because it wants to use zz as part of a glob to match page names. I = changed that so that if the section name (given either as the first operand or = as an argument to -s/-S) doesn't seem valid, it's treated as a page name, = and subsequent completion possibilities are thus returned from all = sections This can still be a problem =E2=80=94 `man 2to3 ` doesn't work = well, for example, because the function thinks 2to3 looks like a (Solaris-style) section = name. I know this can be fixed, but see my last two notes :/ * It looks like someone put some special effort into making the function = at least partially usable on AIX, so i tried to account for that platform = as well... but i don't actually have access to it myself, so the extent = of my testing there was just OSTYPE=3Daix * 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 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 ''` * There were a bunch of options whose purpose wasn't very clear to me, = so i couldn't complete them as well as i wanted to. I put @todos where this = was the case. If anyone knows how they actually work, feel free to change them accordingly * There are some bits that were (or are now) redundant or otherwise not = great =E2=80=94 see the todo note someone left about the sects array for example =E2=80=94= but i just left them alone because i was afraid of breaking something * 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 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 dana diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man index 67810e1dc..14e9e75b5 100644 --- a/Completion/Unix/Command/_man +++ b/Completion/Unix/Command/_man @@ -1,16 +1,169 @@ #compdef man apropos whatis =20 +# Notes: +# - Solaris is seemingly the only OS that doesn't allow the `man n = page` syntax; +# you must use `man -s n page` +# - We assume that Linux distributions are using either man-db or = mandoc +# - @todo Option exclusivity isn't super accurate +# - @todo Solaris man accepts a single hyphen as the first option to = disable +# paging (like AIX's -c); we don't support that +# - @todo Linux apropos/whatis take options; we don't complete them yet + _man() { - local dirs expl mrd awk + local dirs expl mrd awk variant noinsert + local -a context line state state_descr args modes + local -aU sects + local -A opt_args val_args sect_descs =20 - if (( $words[(I)-M] =3D=3D (( $CURRENT - 1 )) )); then - _directories && return 0 - fi + if [[ $service =3D=3D man ]]; then + # We'll treat all mandoc-based systems (Alpine, various Illumos = distros, + # etc.) as OpenBSD + _pick_variant -r variant openbsd=3D'-S subsection' $OSTYPE --- + + modes=3D( + -f -K -k -l -R -w -W + --apropos + --global-apropos + --local-file + --location + --location-cat + --recode + --whatis + --where + --where-cat + ) + [[ $variant =3D=3D darwin* ]] && modes+=3D( -t ) + + args=3D( + "(${(j< >)modes})"{-f,--whatis}'[display short description (like = whatis)]' + "(${(j< >)modes})"{-k,--apropos}'[search for keyword (like = apropos)]' + '(-M --manpath)'{-M+,--manpath=3D}'[specify manual search = path]:manual search path:_sequence -s\: _directories' + ) + if [[ $variant =3D=3D (darwin|dragonfly|freebsd|linux)* ]]; then + args+=3D( + '(-a -S -s --all --sections)'{-a,--all}'[display all matching = pages]' + '(-P --pager)'{-P+,--pager=3D}'[specify output = pager]:pager:_path_commands' + # @todo Could enumerate these + '(-p --preprocessor)'{-p+,--preprocessor=3D}'[specify roff = preprocessor sequence]:preprocessor sequence' + ) + else + args+=3D( '(-s)-a[display all matching pages]' ) + fi + [[ $variant =3D=3D (aix|solaris)* ]] || args+=3D( + '(-C --config-file)'{-C+,--config-file=3D}'[specify configuration = file]:configuration file:_files' + "(${(j< >)modes})"{-w,--path,--where}'[display file locations]' + ) + [[ $variant =3D=3D (aix|netbsd|openbsd)* ]] || args+=3D( + # @todo FreeBSD allows this to be given multiple times + '(-d --debug)'{-d,--debug}'[display debugging information]' + ) + [[ $variant =3D=3D (darwin|dragonfly|freebsd|linux|solaris|aix)* ]] = && args+=3D( + '(-7 -H -t --ascii --html --troff)'{-t,--troff}'[format man page = using troff]' + ) + [[ $variant =3D=3D (darwin|linux)* ]] && args+=3D( + "(${(j< >)modes})"{-K,--global-apropos}'[search for keyword in = all pages]' + '(-m --systems)'{-m+,--systems=3D}'[search manual of specified = system]:operating system' + ) + [[ $variant =3D=3D (darwin|dragonfly|freebsd)* ]] && args+=3D( + '(: -)-h[display help information]' + '(-a)-S+[specify manual sections to search]: :->sects' + ) + [[ $variant =3D=3D (dragonfly|freebsd)* ]] && args+=3D( + # @todo Could enumerate these + '-m[search manual of specified architecture]:architecture' + '-o[use non-localized man pages]' + ) + [[ $variant =3D=3D (netbsd|openbsd)* ]] && args+=3D( + '-c[disable paging]' + '-m[augment manual search path]:manual search path:_sequence -s\: = _directories' + '(-a)-s+[specify manual section to search]: :->sects' + ) + [[ $variant =3D=3D linux* ]] && args+=3D( + '(: -)'{-\?,--help}'[display help information]' + '(-7 -t -H -T -Z --ascii --html --troff --troff-device = --ditroff)'{-7,--asci}'[translate man pages for 7-bit terminal]' + '(-D --default)'{-D,--default}'[reset man to default options]' + # @todo Could enumerate these + '(-E --encoding)'{-E+,--encoding=3D}'[specify output = encoding]:encoding' + '(-e --extension)'{-e+,--extension=3D}'[specify = sub-extension]:sub-extension' + '(-H --html)'{-H-,--html=3D-}'[produce HTML output for specified = browser]::Web browser:_path_commands' + '(-i -I --ignore-case --match-case)'{-i,--ignore-case}'[search = case-insensitively]' + '(-i -I --ignore-case --match-case)'{-I,--match-case}'[search = case-sensitively]' + '(-L --locale)'{-L+,--locale=3D}'[specify = locale]:locale:_locales' + "(${(j< >)modes})"{-l+,--local-file=3D}'[format and display = specified file]:*:::manual file:_files' + "!(${(j< >)modes})"{--location,--location-cat} + '--names-only[match only page names (with --regex or = --wildcard)]' + '(--nh --no-hyphenation)'{--nh,--no-hyphenation}'[disable = hyphenation]' + '(--nj --no-justification)'{--nj,--no-justification}'[disable = justification]' + '--no-subpages[do not combine pairs of page names into single = page name]' + # @todo Could enumerate these + "(${(j< >)modes})"{-R+,--recode=3D}'[output man page in specified = encoding]:encoding' + '(-r --prompt)'{-r+,--prompt=3D}'[specify prompt for less]:less = prompt' + '(-a --all --wildcard)--regex[treat page name as regular = expression]' + '(-a -S -s --all --sections)'{-S+,-s+,--sections=3D}'[specify = manual sections to search]: :->sects' + # @todo Could enumerate these + '(-T -t --troff --troff-device)'{-T-,--troff-device=3D-}'[specify = roff output device]::roff output device' + '(-u --update)'{-u,--update}'[update database caches]' + '(: -)--usage[display brief usage information]' + '(: -)'{-V,--version}'[display version information]' + "(${(j< >)modes})"{-W,--where-cat}'[display cat file locations]' + '--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' + # @todo Post-process how? + '(-t --troff -Z --ditroff)'{-Z,--ditroff}'[post-process output = for chosen device]' + ) + [[ $variant =3D=3D darwin* ]] && args+=3D( + # We use _files here because browsers are usually in = /Applications, which + # typically isn't in PATH + '-B+[specify browser to use for HTML files]:Web browser:_files' + '-c[reformat source man page]' + # @todo -d should be exclusive with this above + '(-d)-D[display man page along with debugging information]' + '(-D -F --preformat)'{-F,--preformat}'[format man page only (do = not display)]' + '-H+[specify command to render HTML as text]:HTML = pager:_path_commands' + # --help and --version are undocumented but functional + '(: -)--help[display help information]' + # -s is also undocumented; it's provided for compatibility with = Solaris + '!(-S)-s+: :->sects' + '(: -)'{-v,--version}'[display version information]' + "(${(j< >)modes})-W[display file locations, one per line, with no = other information]" + ) + [[ $variant =3D=3D netbsd* ]] && args+=3D( + '-h[display only synopsis lines]' + '(: -)-p[display manual search path]' + '-S+[display only man pages with file names matching specified = string]:search string' + ) + [[ $variant =3D=3D openbsd* ]] && args+=3D( + "(${(j< >)modes})-l+[format and display specified = file]:*:::manual file:_files" + # @todo Could enumerate these + '-S[search manual of specified architecture]:architecture' + ) + [[ $variant =3D=3D solaris* ]] && args+=3D( + "(${(j< >)modes})-l[display file locations]" + '-r[format man page only (do not display)]' + '(-a)-s+[specify manual sections to search]: :->sects' + # @todo Does this in fact want a file path? + '-T+[format man page using specified macro package]:macro = package:_files' + ) + [[ $variant =3D=3D aix* ]] && args+=3D( + '-c[display man page using cat]' + '-F[display only first matching entry]' + '-m[only search paths specified by -M/MANPATH]' + '-r[search remotely]' + ) =20 - if [[ $service =3D=3D man ]] && (( $words[(I)-l] + = $words[(I)--local-file] )); then - _files || return 0 + # Strip (most) long options from non-Linux platforms + if [[ $variant =3D=3D darwin* ]]; then + args=3D( = ${(M)args:#((#s)|*\))(\*|)(-[^-]|--(help|path|pref|vers))*} ) + elif [[ $variant !=3D linux* ]]; then + args=3D( ${(M)args:#((#s)|*\))(\*|)-[^-]*} ) + fi fi =20 + _arguments -s -S : $args '*::: :->man' && return 0 + [[ -n $state ]] || return 1 + if (( ! $#_manpath )); then local mp mp=3D( ${(s.:.)$(manpath 2>/dev/null)} ) @@ -23,14 +176,16 @@ _man() { fi =20 (( $#_manpath )) || - _manpath=3D( /usr/man(-/) = /(opt|usr)/(pkg|dt|share|X11R6|local)/(cat|)man(-/) ) + _manpath=3D( /usr/man(-/) = /(opt|usr)/(pkg|dt|share|X11R6|local)/(cat|)man(-/) ) =20 - integer index=3D$words[(I)-M] - if (( index )); then - local opt - opt=3D$words[index+1] - _manpath=3D($opt) - fi + # Override man path + [[ -n ${opt_args[-M]} ]] && + _manpath=3D( ${(s<:>)opt_args[-M]} ) + + # Augment man path + [[ $variant =3D=3D (netbsd|openbsd)* ]] && + [[ -n ${opt_args[-m]} ]] && + _manpath+=3D( ${(s<:>)opt_args[-m]} ) =20 # `sman' is the SGML manual directory for Solaris 7. # 1M is system administrator commands on SVR4 @@ -44,52 +199,158 @@ _man() { # $sect_dirname is from the filesystem, the "3" in = "/usr/share/man/man3" # These are used by _man_pages local sect sect_dirname - if [[ $OSTYPE =3D solaris* ]]; then - sect=3D${${words[(R)-s*]#-s}:-$words[$words[(i)-s]+1]} - sect=3D"${sect//,/|}" - elif [[ -n ${sect:=3D$words[$words[(i)-S]+1]} || -n ${sect:=3D$MANSECT}= ]]; then - sect=3D"${sect//:/|}" - sect=3D"${sect//,/|}" - elif (( CURRENT > 2 )); then - case $words[2] in - (-a) sect=3D'*';; - (-*) ;; - (*) sect=3D$words[2];; - esac + + # Take care: We can't use the sections from these options until we've = finished + # completing them; otherwise (e.g.) -s1: will give no results + if + [[ $service !=3D man ]] || [[ $state =3D=3D sects ]] || (( = $+opt_args[-a] )) + then + sect=3D'*' + elif + [[ $variant =3D=3D (darwin|linux)* ]] && + [[ -n ${opt_args[(i)-S|-s|--sections]} ]] + then + noinsert=3D1 + sect=3D${opt_args[${opt_args[(i)-S|-s|--sections]}]//[:,]/|} + elif + [[ $variant =3D=3D (netbsd|openbsd|solaris)* ]] && (( = $+opt_args[-s] )) + then + noinsert=3D1 + sect=3D${opt_args[-s]//,/|} + elif [[ $variant =3D=3D (dragonfly|freebsd)* ]] && (( $+opt_args[-S] = )); then + noinsert=3D1 + sect=3D${opt_args[-S]//:/|} + elif (( CURRENT > 1 )) && [[ $variant !=3D solaris* ]]; then + noinsert=3D1 + sect=3D$words[1] + elif [[ -n ${sect:=3D$MANSECT} ]]; then + sect=3D${sect//:/|} fi =20 - if [[ $sect =3D (<->*|1M|l|n) || $sect =3D *\|* ]]; then - () { - local -a sects=3D( ${(s.|.)sect} ) - if [[ $sect !=3D (l|n) ]]; then - sects=3D( ${sects%%[^0-9]#} ) - fi - dirs=3D( $^_manpath/(sman|man|cat)${^sects}*/ ) - } - if [[ $sect =3D=3D *\|* ]]; then sect=3D"($sect)"; fi + # Colons may have been escaped + sect=3D${(Q)sect} + + if [[ $sect =3D (<->*|[lnopx]) || $sect =3D *\|* ]]; then + sects=3D( ${(s.|.)sect} ) + 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}" else + sect=3D dirs=3D( $^_manpath/(sman|man|cat)*/ ) awk=3D'{print $1}' fi + + # Ignore directories with no pages inside + dirs=3D( ${^dirs}(#qFN) ) + # Solaris 11 and on have a man-index directory that doesn't contain = manpages dirs=3D( ${dirs:#*/man-index/} ) - if [[ $OSTYPE =3D solaris* && ( $words[CURRENT] =3D -s* || = $words[CURRENT-1] =3D=3D -s ) ]]; then - [[ $words[CURRENT] =3D -s* ]] && compset -P '-s' - sects=3D( ${(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=3D1 + sects=3D( ${(o)${dirs##*(man|cat)}%/} ) + + # 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 + # come from Solaris or one of its variants + (( $#sects )) && () { + sect_descs=3D( + 0 'library headers' + 1 'general commands' + 1cups 'CUPS commands' + 1m 'maintenance commands' + 1openssl 'OpenSSL commands' + 2 'system calls' + 3 'library functions' + 3c 'C library functions' + 3curses 'curses library functions' + 3elf 'ELF library functions' + 3f 'Fortran library functions' + 3lua 'Lua features' # NetBSD + 3mail 'mailbox library functions' + 3openssl 'OpenSSL library functions' + 3pam 'PAM library functions' + 3pool 'pool configuration library functions' + 3proc 'process control library functions' + 3x11 'Xlib functions' + 3xcurses 'curses library functions [X/Open]' + 4 'devices and drivers' + 5 'file formats and conventions' + 3openssl 'OpenSSL configuration files' + 6 'games' + 7 'miscellanea' + 8 'maintenance commands and procedures' + 9 'kernel features' + 9lua 'Lua kernel bindings' # NetBSD + l 'local documentation' # AIX, etc. + n 'new documentation' # AIX, etc. + o 'old documentation' # AIX, etc. + p 'public documentation' # AIX, etc. + x 'X11 features' + ) + + # Add POSIX variants + for 1 in ${(k)sect_descs}; do + [[ $1 =3D=3D <-> ]] || continue + sect_descs+=3D( "${1}p" "${sect_descs[$1]} [POSIX]" ) + done + + # 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' = ) + [[ $OSTYPE =3D=3D solaris* ]] && sect_descs+=3D( + 1t 'Tcl/Tk features' + 3m 'mathematical library functions' + 4 'file formats and conventions' + 5 'miscellanea' + 7 'special files' + 7d 'devices' + 7fs 'file systems' + 7i 'ioctl requests' + 7m 'STREAMS modules' + 7p 'protocols' + 9e 'driver entry points' + 9f 'driver functions' + 9p 'driver properties' + 9s 'driver data structures' + ) + } =20 - sects=3D( ${(o)${dirs##*(man|cat)}%/} ) + [[ $state =3D=3D sects ]] && { + local s + local -a specs + + (( $#sects )) || { + _message 'manual section' + return 1 + } + + # Build specs from descriptions + for s in $sects; do + specs+=3D( "${s}[${(b)sect_descs[$s]}]" ) + done + + if [[ $variant =3D=3D (darwin|dragonfly|freebsd|linux)* ]]; then + _values -s : 'manual section' $specs + elif [[ $variant =3D=3D solaris* ]]; then + _values -s , 'manual section' $specs + else + _values 'manual section' $specs + fi + return + } + + if zstyle -t ":completion:${curcontext}:manuals" separate-sections; = then + local d ret=3D1 =20 (( $#sects )) || return 1 =20 _tags manuals.${^sects} while _tags; do for sect_dirname in $sects; do - _requested manuals.$sect_dirname expl "manual page, section = $sect_dirname" _man_pages && + d=3D$sect_dirname + (( $+sect_descs[$d] )) && d+=3D" (${sect_descs[$d]})" + + _requested manuals.$sect_dirname expl "manual page, section $d" = _man_pages && ret=3D0 done (( ret )) || return 0 @@ -113,7 +374,7 @@ _man_pages() { local pages sopt =20 # What files corresponding to manual pages can end in. - local suf=3D'.((?|<->*)(|.gz|.bz2|.Z|.lzma))' + local suf=3D'.((?|<->*|ntcl)(|.gz|.bz2|.Z|.lzma))' =20 if [[ $PREFIX$SUFFIX =3D */* ]]; then # Easy way to test for versions of man that allow file names. @@ -138,8 +399,8 @@ _man_pages() { # beginning with .<->: that handles problem cases like files called # `POSIX.1.5'. =20 - [[ $OSTYPE =3D solaris* ]] && sopt=3D'-s ' - if ((CURRENT > 2)) || + [[ $variant =3D solaris* ]] && sopt=3D'-s ' + if ((CURRENT > 1 || noinsert)) || ! zstyle -t ":completion:${curcontext}:manuals.$sect_dirname" = insert-sections then compadd "$@" - ${pages%$~suf}