From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13271 invoked from network); 27 Jul 1999 07:48:30 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 27 Jul 1999 07:48:30 -0000 Received: (qmail 15961 invoked by alias); 27 Jul 1999 07:48:11 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 7285 Received: (qmail 15952 invoked from network); 27 Jul 1999 07:48:09 -0000 From: "Bart Schaefer" Message-Id: <990727074804.ZM25420@candle.brasslantern.com> Date: Tue, 27 Jul 1999 07:48:04 +0000 In-Reply-To: Comments: In reply to Tanaka Akira "Re: CVS completer (Re: PATCH: Re: Completion/User functions again)" (Jul 27, 2:10am) References: <199907211127.NAA02895@beta.informatik.hu-berlin.de> <990721155446.ZM6856@candle.brasslantern.com> X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.auc.dk Subject: PATCH: Re: CVS completer (Re: PATCH: Re: Completion/User functions again) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Jul 27, 2:10am, Tanaka Akira wrote: } } I think _cvs* are only for cvs, there is no necessity to make these } autoloadable except _cvs. The following simplifies some of the parameter expansions (use inner quoted substitutions instead of multiple (@) flags) and fixes a bug where no matches were generated for `cvs commit' when the `stat' module is not available (now you may get too many matches, but at least you get some). The code obviously was attempting to generate the same output as _cvstargets but had computed the lines in the CVS/Entries file only in the `stat'-available branch. There's still a bug, which may be a more general completion problem: If the initial prefix of the completion contains a metacharacter (such as '#') that is inserted quoted, the completer thereafter does not match. E.g. zsh% cvs add F#bar F#baz zsh% cvs add zsh% cvs add F\# (BEEP) zsh% cvs add F\# (BEEP) zsh% cvs add F\# zsh% cvs add F# F#bar F#baz zsh% cvs add F# zsh% cvs add F\# Watch out for tabs converted to spaces in the following ... Index: Completion/User/_cvs =================================================================== @@ -157,7 +157,7 @@ _cvsentries () { setopt localoptions nullglob unset if [[ -f ${pref}CVS/Entries ]]; then - entries=( "${(@)${(@)${(@)${(f@)$(<${pref}CVS/Entries)}:#D}#(D|)/}%%/*}" ) + entries=( ${${${${(f)"$(<${pref}CVS/Entries)"}:#D}#(D|)/}%%/*} ) fi } @@ -168,26 +168,27 @@ local line Entries typeset -A mtime + if [[ -f "${pref}CVS/Entries" ]]; then + Entries="$(<${pref}CVS/Entries)" + fi + if ! zmodload -e stat; then zmodload stat; fi if zmodload -e stat; then - if [[ -f "${pref}CVS/Entries" ]]; then - Entries="$(<${pref}CVS/Entries)" - mtime=( "${(@s:/:)${(j:/:)${(@)${(@)${(@)${(M@)${(f@)Entries}:#/*}#/}%/*/*}/\/*\///}}}" ) - entries=( "${(@)${(@)${(M@)${(f@)Entries}:#D/*}#D/}%%/*}" ) - builtin stat -n +mtime -F '%a %b %e %T %Y' "$pref${(@k)^mtime}" | - while read line - do - line=${line#$pref} - if [[ x"$mtime[${line%% *}]" == x"${line#* }" ]]; then - #print up-to-date "${line%% *}" - else - #print locally-modified "${line%% *}" - entries=($entries "${line%% *}") - fi - done - fi + mtime=( ${(s:/:)${(j:/:)${${${${(M)${(f)Entries}:#/*}#/}%/*/*}/\\/*\\///}}} ) + entries=( ${${${(M)${(f)Entries}:#D/*}#D/}%%/*} ) + builtin stat -n +mtime -F '%a %b %e %T %Y' "$pref${(@k)^mtime}" | + while read line + do + line=${line#$pref} + if [[ x"$mtime[${line%% *}]" == x"${line#* }" ]]; then + #print up-to-date "${line%% *}" + else + #print locally-modified "${line%% *}" + entries=($entries "${line%% *}") + fi + done else - entries=( "${(@)${(@)${(@)${(f@)Entries}:#D}#(D|)/}%%/*}" ) + entries=( ${${${${(f)Entries}:#D}#(D|)/}%%/*} ) fi if (( $+OLDTZ )); then TZ="$OLDTZ"; else unset TZ; fi @@ -210,7 +211,7 @@ } _cvsrevisions () { - compadd - "${(@)${(@)${(@M)${(@f)$(cvs -q status -vl .)}:# *}##[ ]##}%%[ ]*}" + compadd - ${${${(M)${(f)"$(cvs -q status -vl .)"}:# *}##[ ]##}%%[ ]*} } _cvsrepositories () { @@ -222,7 +223,7 @@ else compadd - \ $root/^CVSROOT(:t) \ - "${(@)${(@M)${(@f)$(<$root/CVSROOT/modules)}:#[^#]*}%%[ ]*}" + ${${(M)${(f)"$(<$root/CVSROOT/modules)"}:#[^#]*}%%[ ]*} fi } -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com