more option setting cleanup; remove some unnecessary setopts, remove N qualifiers (12917)

This commit is contained in:
Sven Wischnowsky 2000-10-06 13:01:51 +00:00
parent 2f2a33b2ea
commit cb4bb129dd
17 changed files with 39 additions and 35 deletions

View file

@ -1,3 +1,15 @@
2000-10-06 Sven Wischnowsky <wischnow@zsh.org>
* 12917: Completion/Bsd/_bsd_pkg, Completion/Bsd/_kld,
Completion/Builtins/_autoload, Completion/Builtins/_cd,
Completion/Builtins/_compdef, Completion/Builtins/_popd,
Completion/Core/_expand, Completion/Core/_path_files,
Completion/Linux/_rpm, Completion/User/_gcc, Completion/User/_gdb,
Completion/User/_mailboxes, Completion/User/_man,
Completion/User/_perl_modules, Completion/User/_printers,
Completion/User/_zdump: more option setting cleanup; remove some
unnecessary setopts, remove N qualifiers
2000-10-05 Bart Schaefer <schaefer@zsh.org>
* 12912: Completion/Commands/_bash_completions,

View file

@ -7,7 +7,7 @@ _bsd_pkg_packages() {
paths=( "${(@)${(@s.:.)PKG_PATH}:#}" )
_files "$@" -g \*.tgz && ret=0
(( $#path )) && _files "$@" -W paths -g \*.tgz && ret=0
compadd "$@" - /usr/ports/packages/All/*.tgz(N) && ret=0
compadd "$@" - /usr/ports/packages/All/*.tgz && ret=0
return ret
}
@ -37,7 +37,7 @@ _bsd_pkg() {
'-d[remove empty directories]' \
'-f[force deinstallation]' \
'-p:prefix directory:_files -/' \
'*:package to deinstall:compadd - /var/db/pkg/*(N\:t)'
'*:package to deinstall:compadd - /var/db/pkg/*(\:t)'
;;
pkg_info)
@ -57,10 +57,10 @@ _bsd_pkg() {
'-R[show list list of installed requiring packages]' \
'-m[show mtree files]' \
'-L[show full pathnames of files]' \
'-e[test if package is installed]:package name:compadd - /var/db/pkg/*(N\:t)' \
'-e[test if package is installed]:package name:compadd - /var/db/pkg/*(\:t)' \
'-l:prefix directory:_files -/' \
'-t:mktemp template:_files -/' \
'(-a)*:package name:compadd - /var/db/pkg/*(N\:t)'
'(-a)*:package name:compadd - /var/db/pkg/*(\:t)'
;;
esac
}

View file

@ -4,7 +4,7 @@
_kld_module() {
local ret=1
compadd "$@" - /boot/kernel/*.ko(N:t) /modules/*.ko(N:t) && ret=0
compadd "$@" - /boot/kernel/*.ko(:t) /modules/*.ko(:t) && ret=0
_files "$@" -g \*.ko && ret=0
return ret

View file

@ -6,5 +6,5 @@ if (( $words[(I)[-+]*w*] )); then
_description files expl 'zwc file'
_files "$expl[@]" -g '*.zwc'
else
_wanted functions expl 'shell function' compadd - ${^fpath}/*(N:t)
_wanted functions expl 'shell function' compadd - ${^fpath}/*(:t)
fi

View file

@ -19,7 +19,7 @@ if [[ CURRENT -eq 3 ]]; then
# cd old new: look for old in $PWD and see what can replace it
local rep
# Get possible completions using word in position 2
rep=(${~PWD/$words[2]/*}~$PWD(-/N))
rep=(${~PWD/$words[2]/*}~$PWD(-/))
# Now remove all the common parts of $PWD and the completions from this
rep=(${${rep#${PWD%%$words[2]*}}%${PWD#*$words[2]}})
(( $#rep )) && _wanted -C replacement strings expl replacement compadd -a rep

View file

@ -33,7 +33,7 @@ case $state in
_wanted commands expl 'completed command' compadd -k _comps
;;
cfun)
list=( ${^fpath:/.}/_(|*[^~])(N:t) )
list=( ${^fpath:/.}/_(|*[^~])(:t) )
if zstyle -T ":completion:${curcontext}:functions" prefix-hidden; then
disp=( ${list[@]#_} )
_wanted functions expl 'completion function' \

View file

@ -5,7 +5,7 @@
# way round if pushdminus is set). Note that this function is also called
# from _cd for cd and pushd.
setopt extendedglob nonomatch
setopt localoptions nonomatch
local expl list lines revlines disp

View file

@ -7,7 +7,7 @@
# the expansions done produce no result or do not change the original
# word from the line.
setopt localoptions nullglob nonomatch
setopt localoptions nonomatch
[[ _matcher_num -gt 1 ]] && return 1

View file

@ -10,9 +10,6 @@ local nm=$compstate[nmatches] menu matcher mopts sort match mid accex fake
typeset -U prepaths exppaths
setopt localoptions nullglob rcexpandparam
unsetopt markdirs globsubst shwordsplit nounset
exppaths=()
# Get the options.
@ -317,7 +314,7 @@ for prepath in "$prepaths[@]"; do
# Force auto-mounting. There might be a better way...
: ${^tmp1}/${PREFIX}${SUFFIX}/.(N/)
: ${^tmp1}/${PREFIX}${SUFFIX}/.(/)
# Get the matching files by globbing.

View file

@ -269,7 +269,7 @@ fi
_rpms_caching_policy () {
# rebuild if cache is more than a week old
oldp=( "$1"(Nmw+1) )
oldp=( "$1"(mw+1) )
(( $#oldp )) && return 0
[[ /var/lib/rpm/packages.rpm -nt "$1" ]]

View file

@ -274,7 +274,7 @@ dump)
;;
library)
_wanted libraries expl library \
compadd - ${^=LD_LIBRARY_PATH:-/usr/lib /usr/local/lib}/lib*.(a|so*)(N:t:fr:s/lib//) && ret=0
compadd - ${^=LD_LIBRARY_PATH:-/usr/lib /usr/local/lib}/lib*.(a|so*)(:t:fr:s/lib//) && ret=0
;;
esac

View file

@ -5,12 +5,12 @@ local cur="$words[CURRENT]" prev w list ret=1 expl
[[ "$PREFIX" = --* ]] &&
_arguments -- '*=(CORE|SYM)FILE:core file:_files' \
'*=EXECFILE:executable:_files -g \*\(-\*\)' \
'*=TTY:terminal device:compadd /dev/tty\*\(N\)' && return 0
'*=TTY:terminal device:compadd /dev/tty\*' && return 0
if compset -P '-(cd|directory)='; then
_files -/
elif compset -P '-tty='; then
_wanted devices expl 'terminal device' compadd - /dev/tty*(N)
_wanted devices expl 'terminal device' compadd - /dev/tty*
elif compset -P '-(exec|se)='; then
_description files expl executable
_files "$expl[@]" -g '*(-*)'

View file

@ -67,17 +67,15 @@ _mailbox_cache () {
typeset -aU -g _mailbox_cache
typeset -aU -g _maildir_cache _mbox_cache _mh_cache _mutt_cache _pine_cache
setopt localoptions nullglob
[[ -f ${~muttrc:-.} ]] &&
_mutt_cache=( ${=${(M)${(f)"$(<${~muttrc})"}:#mailboxes *}#mailboxes *} )
_mbox_cache=( ${~maildirectory}/*(N^/) )
_pine_cache=( ${~pinedirectory}/**/*(N.) )
_mbox_cache=( ${~maildirectory}/*(^/) )
_pine_cache=( ${~pinedirectory}/**/*(.) )
dirboxes=( ${~maildirectory}/*(N/) )
dirboxes=( ${~maildirectory}/*(/) )
while (( $#dirboxes )); do
i=${dirboxes[1]}
@ -87,7 +85,7 @@ _mailbox_cache () {
elif j=( "$i"/<1-> ) && [[ -n "$j" ]]; then
_mh_cache=( "${_mh_cache[@]}" "$i" )
else
_mbox_cache=( "${_mbox_cache[@]}" "$i"/*(N.) )
_mbox_cache=( "${_mbox_cache[@]}" "$i"/*(.) )
dirboxes=( $dirboxes "$i"/*(/) )
fi
done

View file

@ -1,7 +1,5 @@
#compdef man apropos whatis
setopt localoptions rcexpandparam
local rep expl star approx mrd
if [[ $words[1] == man ]] && (( $words[(I)-l] + $words[(I)--local-file] )); then
@ -26,7 +24,7 @@ if (( ! $#manpath )); then
fi
(( $#manpath )) || manpath=( ${(s.:.)$(manpath 2>/dev/null)} ) ||
manpath=( /usr/man(-/N) /(opt|usr)/(dt|share|X11R6|local)/(cat|)man(-/N) )
manpath=( /usr/man(-/) /(opt|usr)/(dt|share|X11R6|local)/(cat|)man(-/) )
# `sman' is the SGML manual directory for Solaris 7.
# 1M is system administrator commands on SVR4
@ -34,10 +32,10 @@ fi
mrd=(${^manpath/\%L/${LANG:-En_US.ASCII}}/mandb(N))
if [[ $words[2] = (<->*|1M|l|n) ]]; then
rep=(
$manpath/(sman|man|cat)${words[2]}/${~approx}$PREFIX${~star}$SUFFIX.*(N:t) )
$manpath/(sman|man|cat)${words[2]}/${~approx}$PREFIX${~star}$SUFFIX.*(:t) )
(($#mrd)) && rep[$#rep+1]=($(awk "\$2 == \"$words[2]\" {print \$1}" $mrd))
else
rep=( $manpath/(sman|man|cat)*/${~approx}$PREFIX${~star}$SUFFIX.*(N:t) )
rep=( $manpath/(sman|man|cat)*/${~approx}$PREFIX${~star}$SUFFIX.*(:t) )
(($#mrd)) && rep[$#rep+1]=($(awk '{print $1}' $mrd))
fi

View file

@ -46,7 +46,6 @@ _perl_modules () {
# complete Perl modules. Maybe her $path is wrong?
_message "Didn't find perl on \$PATH; guessing @INC ..."
setopt localoptions extendedglob
inc=( /usr/lib/perl5{,/{site_perl/,}<5->.([0-9]##)}(N)
${(s.:.)PERL5LIB} )
fi
@ -61,7 +60,7 @@ _perl_modules () {
# Find all modules
if [[ -d $libdir && -x $libdir ]]; then
cd $libdir
new_pms=( {[A-Z]*/***/,}*.pm~*blib*(N) )
new_pms=( {[A-Z]*/***/,}*.pm~*blib* )
cd $OLDPWD
fi
@ -84,10 +83,10 @@ _perl_modules_caching_policy () {
local _perllocals
# rebuild if cache is more than a week old
oldp=( "$1"(Nmw+1) )
oldp=( "$1"(mw+1) )
(( $#oldp )) && return 0
_perllocals=( /usr/lib/perl5/**/perllocal.pod(N) )
_perllocals=( /usr/lib/perl5/**/perllocal.pod )
if (( $#_perllocals )); then
for pod in $_perllocals; do

View file

@ -11,7 +11,7 @@ fi
if (( ! $+_lp_cache )); then
local file entry names i
file=( /etc/(printcap|printers.conf)(N) )
file=( /etc/(printcap|printers.conf) )
_lp_cache=()
_lp_alias_cache=()

View file

@ -1,7 +1,7 @@
#compdef zdump
if (( ! $+_zoneinfo_dirs )); then
_zoneinfo_dirs=( /usr/{share,lib,share/lib}/zoneinfo*(N/) )
_zoneinfo_dirs=( /usr/{share,lib,share/lib}/zoneinfo*(/) )
fi
_arguments '-v[lowest possible]' \