From 206237c8ec4b7619d9e70a75004cd1ae1066b0a0 Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Sun, 25 Apr 1999 15:43:41 +0000 Subject: zsh-3.1.5-pws-16 --- Completion/Core/_path_files | 18 +++++++++++------- Completion/Core/compdump | 2 +- Completion/Core/compinit | 42 +++++++++++++++++++++++++++--------------- Completion/User/_find | 4 ++-- Completion/User/_make | 2 +- 5 files changed, 42 insertions(+), 26 deletions(-) (limited to 'Completion') diff --git a/Completion/Core/_path_files b/Completion/Core/_path_files index 21837ade2..ed799be84 100644 --- a/Completion/Core/_path_files +++ b/Completion/Core/_path_files @@ -153,7 +153,7 @@ if [[ "$pre[1]" = \~ ]]; then # prefix path by setting `prepaths'. linepath="${pre%%/*}/" - eval realpath\=$linepath + realpath=$~linepath [[ "$realpath" = "$linepath" ]] && return 1 pre="${pre#*/}" orig="${orig#*/}" @@ -236,8 +236,14 @@ for prepath in "$prepaths[@]"; do # the outer loop. if [[ $#tmp2 -eq 0 ]]; then - [[ "$tmp1[1]" = */* ]] && - exppaths=( "$exppaths[@]" ${^tmp1%/*}/${tpre}${tsuf} ) + if [[ "$tmp1[1]" = */* ]]; then + tmp2=( "${(@)tmp1#${prepath}${realpath}}" ) + if [[ "$tmp2[1]" = */* ]]; then + exppaths=( "$exppaths[@]" ${^tmp2%/*}/${tpre}${tsuf} ) + else + exppaths=( "$exppaths[@]" ${tpre}${tsuf} ) + fi + fi continue 2 fi @@ -249,8 +255,6 @@ for prepath in "$prepaths[@]"; do tmp1=( "${(@M)tmp1:#(${(j:|:)~${(@)tmp2:q}})}" ) fi elif (( ! $#tmp1 )); then - [[ "$tmp1[1]" = */* ]] && - exppaths=( "$exppaths[@]" ${^tmp1%/*}/${tpre}${tsuf} ) continue 2 fi @@ -375,8 +379,8 @@ exppaths=( "${(@)exppaths:#$orig}" ) if [[ -n "$compconfig[path_expand]" && $#exppaths -ne 0 && nm -eq compstate[nmatches] ]]; then - compadd -U -S '' "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" - \ - "${(@)exppaths}" + compadd -U -S '' "$group[@]" "$expl[@]" -i "$IPREFIX" -I "$ISUFFIX" \ + -p "$linepath" - "${(@)exppaths}" fi [[ nm -eq compstate[nmatches] ]] diff --git a/Completion/Core/compdump b/Completion/Core/compdump index 6a46f3265..8288ccdd4 100644 --- a/Completion/Core/compdump +++ b/Completion/Core/compdump @@ -18,7 +18,7 @@ _d_file=${compconfig[dumpfile]-${0:h}/compinit.dump} typeset -U _d_files -_d_files=( ${^~fpath}/_*~*~(N:t) ) +_d_files=( ${^~fpath}/_(|*[^~])(N:t) ) print "#files: $#_d_files" > $_d_file diff --git a/Completion/Core/compinit b/Completion/Core/compinit index 20b1262ec..72d5fde28 100644 --- a/Completion/Core/compinit +++ b/Completion/Core/compinit @@ -217,15 +217,30 @@ compdef() { # With the option `-l' as the first argument, the other arguments are # taken to be key names and the values for theses keys are printed, one # per line. +# When listing is done and the `-L' option is given, the keys and +# values are printed as invocations for this function, usable to be put +# inte a setup script. compconf() { - local i + local i opt list + + while getopts "lL" opt; do + if [[ "$opt" = l ]]; then + [[ -z "$list" ]] && list=yes + else + list=long + fi + done + shift OPTIND-1 if (( $# )); then - if [[ "$1" = -l ]]; then - shift + if [[ -n $list ]]; then for i; do - print $compconfig[$i] + if [[ $list = long ]]; then + (( ${+compconfig[$i]} )) && print "compconf $i='$compconfig[$i]'" + else + print $compconfig[$i] + fi done else for i; do @@ -238,20 +253,19 @@ compconf() { fi else for i in ${(k)compconfig}; do - print ${(r:25:)i} $compconfig[$i] + if [[ $list = long ]]; then + print "compconf $i='$compconfig[$i]'" + else + print ${(r:25:)i} $compconfig[$i] + fi done fi } # Now we automatically make the definition files autoloaded. -if [[ ! -o extendedglob ]]; then - _i_noextglob=yes - setopt extendedglob -fi - typeset -U _i_files -_i_files=( ${^~fpath}/_*~*~(N:t) ) +_i_files=( ${^~fpath}/_(|*[^~])(N:t) ) _i_initname=$0 _i_done='' @@ -268,7 +282,7 @@ fi if [[ -z "$_i_done" ]]; then for _i_dir in $fpath; do [[ $_i_dir = . ]] && continue - for _i_file in $_i_dir/_*~*~(N); do + for _i_file in $_i_dir/_(|*[^~])(N); do read -rA _i_line < $_i_file _i_tag=$_i_line[1] shift _i_line @@ -306,6 +320,4 @@ if [[ -z "$_i_done" ]]; then (( _i_autodump )) && builtin . ${_i_initname:h}/compdump fi -[[ -z "$_i_noextglob" ]] || unsetopt extendedglob - -unset _i_files _i_initname _i_done _i_autodump _i_noextglob +unset _i_files _i_initname _i_done _i_autodump diff --git a/Completion/User/_find b/Completion/User/_find index 116ee6f6b..dd00b0ed1 100644 --- a/Completion/User/_find +++ b/Completion/User/_find @@ -2,7 +2,7 @@ local prev="$words[CURRENT-1]" -if compset -N '-(ok|exec)' '\;' then +if compset -N '-(ok|exec)' '\;'; then _normal elif compset -P 1 -; then compgen -s 'daystart {max,min,}depth follow noleaf version xdev \ @@ -13,7 +13,7 @@ elif [[ CURRENT -eq 2 ]]; then local ret=1 compgen -g '. ..' && ret=0 - _files -g '(-/)' && ret=0 + _files -g '*(-/)' && ret=0 return ret elif [[ "$prev" = -((a|c|)newer|fprint(|0|f)) ]]; then diff --git a/Completion/User/_make b/Completion/User/_make index f950ad754..acaa56b8e 100644 --- a/Completion/User/_make +++ b/Completion/User/_make @@ -1,3 +1,3 @@ #compdef make gmake pmake -compgen -s "\$(awk '/^[a-zA-Z0-9][^\/ ]+:/ {print \$1}' FS=: [mM]akefile)" +compgen -s "\$(awk '/^[a-zA-Z0-9][^\/ ]+:/ {print \$1}' FS=: [mM]akefile /dev/null)" -- cgit 1.4.1