From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru>,
<zsh-workers@sunsite.dk>
Subject: Re: _man igores global matchers
Date: Thu, 31 May 2001 17:20:48 +0000 [thread overview]
Message-ID: <1010531172048.ZM18548@candle.brasslantern.com> (raw)
In-Reply-To: <1010531154643.ZM18373@candle.brasslantern.com>
[-- Attachment #1: Type: text/plain, Size: 936 bytes --]
I wrote:
}
} This patch drops the filtering on man page name and instead slurps up all
} the file basenames into the `rep' array, then passes that and the global
} matcher spec to compadd to let it sort out the mess. If you have several
} matchers this can get pretty slow, so it ought at least to cache `rep'
} somewhere during the loop over the matchers; as it stands this is mostly
} a proof of concept.
Here's a better variation, which actually does cache the results for one
pass around the matcher loop. It's quite a bit faster than with the
patch from 14621, but still slower than the existing _man.
The diff is bigger than the file, because of re-indentation, so I've just
attached the entire file.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
[-- Attachment #2: Text --]
[-- Type: text/plain , Size: 1291 bytes --]
#compdef man apropos whatis
local rep expl mrd
if [[ $service == man ]] && (( $words[(I)-l] + $words[(I)--local-file] )); then
_files || return 0
fi
if (( ! $#manpath )); then
local mp
mp=($(manpath 2>/dev/null))
[[ "$mp" == *:* ]] && mp=( ${(s.:.)mp} )
manpath=( $mp )
(( $#manpath )) || manpath=( ${(s.:.)$(manpath 2>/dev/null)} ) ||
manpath=( /usr/man(-/) /(opt|usr)/(dt|share|X11R6|local)/(cat|)man(-/) )
fi
if (( _matcher_num < 2 )); then
# `sman' is the SGML manual directory for Solaris 7.
# 1M is system administrator commands on SVR4
mrd=(${^manpath/\%L/${LANG:-En_US.ASCII}}/mandb(N))
if [[ $words[2] = (<->*|1M|l|n) ]]; then
rep=(
$manpath/(sman|man|cat)${words[2]}/*.*(:t) )
(($#mrd)) && rep[$#rep+1]=($(awk "\$2 == \"$words[2]\" {print \$1}" $mrd))
else
rep=( $manpath/(sman|man|cat)*/*.*(:t) )
(($#mrd)) && rep[$#rep+1]=($(awk '{print $1}' $mrd))
fi
# Remove any compression suffix, then remove the minimum possible string
# beginning with .<->: that handles problem cases like files called
# `POSIX.1.5'.
rep=(${${rep%%.(bz2|z|gz|Z)}%.<->*})
mrd=( ${(q)rep} )
eval "_man_cached() { rep=( $mrd ) }"
else
_man_cached
fi
(( $#rep )) &&
_wanted manuals expl 'manual page' compadd -M "$_matcher" -a rep
next prev parent reply other threads:[~2001-05-31 17:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-05-29 12:05 Andrej Borsenkow
2001-05-29 12:18 ` Sven Wischnowsky
2001-05-31 13:32 ` Andrej Borsenkow
2001-05-31 15:24 ` Sven Wischnowsky
2001-05-31 15:46 ` Bart Schaefer
2001-05-31 17:20 ` Bart Schaefer [this message]
2001-06-01 11:40 ` Sven Wischnowsky
2001-06-01 11:49 ` Sven Wischnowsky
2001-06-01 12:15 ` Clint Adams
2001-06-01 13:57 ` Bart Schaefer
2001-06-01 14:20 ` Sven Wischnowsky
2001-06-01 15:46 ` Bart Schaefer
2001-06-06 9:37 ` PATCH: " Sven Wischnowsky
2001-06-01 15:56 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1010531172048.ZM18548@candle.brasslantern.com \
--to=schaefer@candle.brasslantern.com \
--cc=Andrej.Borsenkow@mow.siemens.ru \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).