From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2381 invoked from network); 13 Mar 2002 18:00:28 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 13 Mar 2002 18:00:28 -0000 Received: (qmail 2016 invoked by alias); 13 Mar 2002 18:00:15 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 16823 Received: (qmail 2000 invoked from network); 13 Mar 2002 18:00:13 -0000 X-VirusChecked: Checked Date: Wed, 13 Mar 2002 17:58:45 +0000 From: Oliver Kiddle To: zsh-workers@sunsite.dk Subject: Re: Redirection completion Message-ID: <20020313175845.GA27238@logica.com> References: <15496.46201.219885.149096@wischnow.berkom.de> <22196.1015596405@csr.com> <15496.50795.888698.447601@wischnow.berkom.de> <15500.28153.769884.199234@wischnow.berkom.de> <20020312131651.GA28986@logica.com> <15503.6928.151944.873784@wischnow.berkom.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <15503.6928.151944.873784@wischnow.berkom.de> User-Agent: Mutt/1.3.27i Sender: Oliver Kiddle Sven wrote: > And another question where the default-handling is important is: when > should post-patterns (-P) be tried? Currently this is done only if we > would otherwise use the function defined for the least specific > context (the one with all parts being `-default-'). Hmm, we might want to define -redirect-,<,-default- and would want patterns tried before that. I think the post-patterns should perhaps be tried just before -default- is first tried in the command position for redirection and in the parameter name position for values. Or perhaps, we need to look to see where each post-pattern uses -default-. If it uses a pattern for one part then we should use it before trying -default- for that part. We might need to require patterns to all be of the form -whatever-,pattern,pattern. > Can't say anything about this without more information. Have you > remembered to remove the dump-file? I had. I'm not sure what was wrong but it all works now with the latest patch. I may have had an old version of a function in my ~/.zfunc. > Aha. Ugh. No. See above, `-redirect-,-default-,gzip' etc. are enough. > Not that short either, I admit, but allowing braces there isn't *that* > simple (well, it isn't that hard either, a bit of `eval' with an array > and some quoting magic, but...). Ah, that is better, and neater than braces. I hadn't picked up on that part of the idea. Very neat. The patch below does the GZIP thing I mentioned. I've also added pattern completions for *PATH and *path parameters using _dir_list and _directories respectively. I've not thought of any exceptions where this isn't appropriate but I'll leave sufficient time for objections before committing. Oliver Index: Completion/Unix/Command/_gzip =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_gzip,v retrieving revision 1.2 diff -u -r1.2 _gzip --- Completion/Unix/Command/_gzip 31 Jul 2001 13:54:04 -0000 1.2 +++ Completion/Unix/Command/_gzip 13 Mar 2002 17:17:05 -0000 @@ -1,9 +1,16 @@ -#compdef gzip gunzip gzcat=gunzip +#compdef gzip gunzip gzcat=gunzip -value-,GZIP,-default- -local decompress expl curcontext="$curcontext" state line +local decompress files expl curcontext="$curcontext" state line typeset -A opt_args +files=( '*:files:->files' ) case "$service" in +*GZIP*) + compset -q + words=( fake "$words[@]" ) + (( CURRENT++ )) + files=() + ;& gunzip|zcat) decompress=yes ;& @@ -51,7 +58,7 @@ '(--fast -1 -2 -3 -4 -5 -6 -7 -9 --best)-8' \ '(--fast -1 -2 -3 -4 -5 -6 -7 -8 --best)-9' \ '(--fast -1 -2 -3 -4 -5 -6 -7 -8 -9 )--best' \ - '*:files:->files' && return 0 + "$files[@]" && return 0 ;; esac Index: Completion/Unix/Type/_dir_list =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_dir_list,v retrieving revision 1.2 diff -u -r1.2 _dir_list --- Completion/Unix/Type/_dir_list 13 Jun 2001 11:05:51 -0000 1.2 +++ Completion/Unix/Type/_dir_list 13 Mar 2002 17:17:05 -0000 @@ -1,4 +1,4 @@ -#autoload +#compdef -value-,TERMINFO_DIRS,-default- -P -value-,*PATH,-default- # options: # -s to specify the separator (default is a colon) Index: Completion/Unix/Type/_directories =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_directories,v retrieving revision 1.4 diff -u -r1.4 _directories --- Completion/Unix/Type/_directories 20 Feb 2002 12:51:53 -0000 1.4 +++ Completion/Unix/Type/_directories 13 Mar 2002 17:17:05 -0000 @@ -1,4 +1,4 @@ -#compdef rmdir df du dircmp +#compdef rmdir df du dircmp -P -value-,*path,-default- local expl 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.