From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4769 invoked from network); 4 May 2001 16:41:17 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 4 May 2001 16:41:17 -0000 Received: (qmail 4229 invoked by alias); 4 May 2001 16:41:11 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 14224 Received: (qmail 4211 invoked from network); 4 May 2001 16:41:10 -0000 From: "Bart Schaefer" Message-Id: <1010504163954.ZM19303@candle.brasslantern.com> Date: Fri, 4 May 2001 16:39:54 +0000 In-Reply-To: <1010504051600.ZM18512@candle.brasslantern.com> Comments: In reply to "Bart Schaefer" "PATCH: Re: cvs completion does not support partial path completion" (May 4, 5:16am) References: <200104300817.KAA02260@beta.informatik.hu-berlin.de> <1010430165626.ZM4866@candle.brasslantern.com> <1010504051600.ZM18512@candle.brasslantern.com> X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.dk Subject: Re: PATCH: Re: cvs completion does not support partial path completion MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On May 4, 5:16am, Bart Schaefer wrote: } Subject: PATCH: Re: cvs completion does not support partial path completio } } The following seems to give the desired behavior for the most part. It } does partial-path completion as far as possible, then stops leaving the } trailing file name uncompleted. Press TAB again, and it completes the } final part by examining the CVS/Entries file as usual. Here's the patch as I actually plan to commit it. In addition to the problem with the empty message-part of the _arguments spec, I found that it didn't complete properly in the middle of a word. Index: Completion/Unix/Command/_cvs =================================================================== --- Completion/Unix/Command/_cvs 2001/04/09 20:14:09 1.1.1.1 +++ Completion/Unix/Command/_cvs 2001/05/04 16:33:59 @@ -73,7 +73,7 @@ _arguments -s \ '-k+[keyword]:keyword substitution:_cvs_k' \ '-m+[message]:message:_cvs_m' \ - '*:file:_cvs_files_unmaintained' \ + '*:added file:_cvs_files_unmaintained' \ } (( $+functions[_cvs_admin] )) || @@ -157,7 +157,7 @@ '(-F)-m+[message]:message:_cvs_m' \ '(-m)-F+[message file]:log message file:_files' \ '-r+[specify revision]:tag:_cvs_revisions' \ - '*:file:_cvs_files_modified' + '*:modified file:_cvs_files_modified' } (( $+functions[_cvs_diff] )) || @@ -434,7 +434,7 @@ '-f[force to remove]' \ '(-R)-l[don'\''t recursive]' \ '(-l)-R[recursive]' \ - '*:file:_cvs_remove_arg' + '*:removed file:_cvs_remove_arg' } (( $+functions[_cvs_remove_arg] )) || @@ -516,7 +516,7 @@ '(-D)-r+[specify revision]:tag:_cvs_revisions' \ '(-r)-D+[specify date]:date:_cvs_D' \ '-j+[merge]:tag:_cvs_revisions' \ - '*-I+[ignore files]:name:_files' \ + '*-I+[ignore files]:file:_files' \ '*-W+[wrapper specification]:spec:_files' \ '*:file:_cvs_files' } @@ -856,7 +856,8 @@ (( $+functions[_cvs_existing_directories] )) || _cvs_existing_directories () { local expl - _wanted files expl file _path_files -g "*~(*/|)CVS(/)" + _wanted directories expl directory _path_files -g "*~(*/|)CVS(/)" || + _cvs_path_prefixes } (( $+functions[_cvs_existing_entries] )) || @@ -881,7 +882,7 @@ realdir=${(e)~linedir} [[ -f "$realdir"CVS/Entries ]] && [[ -n ${pat::="${(@j:|:)${(@)${(@)${(@)${(@)${(@)${(@M)${(@f)"$(<"$realdir"CVS/Entries)"}:#/*}#/}/\\/[^\\/]#\\///}%/[^/]#/[^/]#}:#${(j:|:)~${${${${(f)"$(LC_ALL=C builtin stat -gn +mtime -F '%a %b %e %T %Y' ${realdir}*(D) 2>/dev/null)"}##*/}/ //}//(#m)[][*?()<|^~#\\]/\\$MATCH}}}%%/*}//(#m)[][*?()<|^~#\\]/\\$MATCH}"} ]] && - _wanted files expl file _path_files -g "$pat" + _wanted files expl 'modified file' _path_files -g "$pat" else _cvs_existing_entries fi @@ -945,7 +946,20 @@ ${${${${(M)${(f)"$(<"$realdir"CVS/Entries)"}:#(D|)/*}#(D|)/}%%/*}:#${(j:|:)~${files//(#m)[][*?()<|^~#\\]/\\$MATCH}}} ) compquote files - _wanted files expl file compadd -Qp "$linedir" -a files + _wanted files expl 'removed file' compadd -Qp "$linedir" -a files + } +} + +(( $+functions[_cvs_path_prefixes] )) || +_cvs_path_prefixes () { + local expl match + match=() + [[ "$PREFIX$SUFFIX" = (#b)(*)(/[^/]#) ]] && { + PREFIX="$match[1]" + ISUFFIX="$match[2]$ISUFFIX" + SUFFIX='' + _wanted directories expl directory \ + _path_files -g "*~($PREFIX|(*/|)CVS)(/)" -S '' } } -- 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