From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16177 invoked from network); 21 Feb 2003 10:49:08 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 21 Feb 2003 10:49:08 -0000 Received: (qmail 1807 invoked by alias); 21 Feb 2003 10:49:01 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 18269 Received: (qmail 1800 invoked from network); 21 Feb 2003 10:49:00 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 21 Feb 2003 10:49:00 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [193.109.254.147] by sunsite.dk (MessageWall 1.0.8) with SMTP; 21 Feb 2003 10:49:0 -0000 X-VirusChecked: Checked X-Env-Sender: kiddleo@logica.com X-Msg-Ref: server-23.tower-27.messagelabs.com!1045824561!2250 Received: (qmail 16135 invoked from network); 21 Feb 2003 10:49:21 -0000 Received: from iris.logica.co.uk (158.234.9.163) by server-23.tower-27.messagelabs.com with SMTP; 21 Feb 2003 10:49:21 -0000 Received: from finches.logica.co.uk ([158.234.142.11]) by iris.logica.co.uk (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id KAA25015 for ; Fri, 21 Feb 2003 10:48:55 GMT X-Authentication-Warning: iris.logica.co.uk: Host [158.234.142.11] claimed to be finches.logica.co.uk Received: from finches.logica.co.uk (localhost [127.0.0.1]) by finches.logica.co.uk (8.11.6/8.11.6/SuSE Linux 0.5) with ESMTP id h1LAqJg04226 for ; Fri, 21 Feb 2003 11:52:19 +0100 From: Oliver Kiddle To: Zsh workers Subject: PATCH: improve _sccs' file completion Date: Fri, 21 Feb 2003 11:52:19 +0100 Message-ID: <4224.1045824739@finches.logica.co.uk> Sender: kiddleo@logica.com This improves the file completion in _sccs to properly handle both s. files referenced directly and files referenced indirectly. I think there is a bug somewhere with _files or something. With this function: _foo() { local ret=1 _files && ret=0 compset -P '*/' compadd one two three && ret=0 return ret } compdef _foo foo mkdir SCCS foo SCCS/ For some reason, the / is removed - compstate[unambiguous] contains just `SCCS'. With the compadd before the _files it works as I'd expect but PREFIX/IPREFIX need to be saved either manually (as below) or by using another function to reverse the compset. Any ideas anyone? Oliver Index: Completion/Unix/Command/_sccs =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_sccs,v retrieving revision 1.1 diff -u -r1.1 _sccs --- Completion/Unix/Command/_sccs 11 Mar 2002 13:08:27 -0000 1.1 +++ Completion/Unix/Command/_sccs 21 Feb 2003 10:32:23 -0000 @@ -2,10 +2,17 @@ (( $+functions[_sccs_files] )) || _sccs_files() { - local dir=${PROJECTDIR:-~+}/${PREFIX##*/}/$finalpath - - compset -P '*/' - _files -W $dir -g \*\(:s/s.//\) "$@" + local dir expl ret=1 pref=$PREFIX ipref=$IPREFIX + dir="${(M)PREFIX##*/}$finalpath" + [[ $~dir = (.|..|)/* ]] || dir="${PROJECTDIR:-~+}/$dir" + compset -P "*/" + _wanted file expl file compadd "$@" - $~dir/*(N.:t:s/s.//) && ret=0 + PREFIX="$pref" + IPREFIX="$ipref" + _wanted sccs-files expl 'sccs file' _files -W ${PROJECTDIR:-~+} \ + -g 's.*' && ret=0 + + return ret } local curcontext="$curcontext" state line @@ -20,7 +27,7 @@ ropt='-r+[specify sccs delta id]:sccs delta id' copt='-c+[specify date]:date-stamp' -sfiles=':file:_sccs_files' +sfiles=":file:_files -g s.\*" if [[ $service = sccs ]]; then _arguments -C -A "-*" \ @@ -34,6 +41,7 @@ return fi service="$words[1]" + sfiles=':file:_sccs_files' curcontext="${curcontext%:*}-$service:" fi finalpath="${opt_args[-p]:-SCCS}" This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.