From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19338 invoked from network); 11 Mar 2002 16:58:43 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 11 Mar 2002 16:58:43 -0000 Received: (qmail 18001 invoked by alias); 11 Mar 2002 16:58:35 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 16806 Received: (qmail 17989 invoked from network); 11 Mar 2002 16:58:33 -0000 From: "Bart Schaefer" Message-Id: <1020311165607.ZM27129@candle.brasslantern.com> Date: Mon, 11 Mar 2002 16:56:07 +0000 In-Reply-To: <15500.40522.132670.814408@wischnow.berkom.de> Comments: In reply to Sven Wischnowsky "Re: Redirection completion" (Mar 11, 1:08pm) References: <15500.37377.808155.293654@wischnow.berkom.de> <19534.1015846146@csr.com> <15500.40522.132670.814408@wischnow.berkom.de> X-Mailer: Z-Mail (5.0.0 30July97) To: Sven Wischnowsky , zsh-workers@sunsite.dk Subject: Re: Redirection completion MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Mar 11, 1:08pm, Sven Wischnowsky wrote: } } Peter Stephenson wrote: } } > if I'm in some generic form of redirection completion I can still check } > for `-redirect-echo-2>' in pattern-files, or does the context still just } > look like `-redirect-2>' or `-redirect--default-'? } } But I'm not really sure which string to prefer in each case. I'd } prefer the most specific one, i.e. `-redirect-echo-2>' in this case. } Would that be ok for our users if we document it? I think using the most-specific is fine, but I'd like to request a change in the format. Firstly I'd like to keep the "flavor" of redirection tightly associated with the word `redirect', i.e. rather than -redirect-echo-2> It should be -redirect-2>-echo Then, I think, it would not be necessary to try each of `-redirect-', `-redirect-2>', and `-redirect-2>-echo' in turn, because styles could be written easily with wildcards e.g. `-redirect-*' or `-redirect-2>*'. Unless I'm missing something about why all three are tried? This points up the second change I'd like to request: Make this style fragment work the same way that styles in general work, e.g., define a fixed set of delimiter-separated segments and have them always be there even if sometimes empty. E.g. supposing we switched to comma as the delimiter, as Sven tossed out in one of the earlier messages on this thread, the context would look like `-redirect-,2>,echo' and if for some reason the command name were not known it would be `-redirect-,2>,'. I suppose strictly speaking the first of those commas could be omitted because we must always know what redirection operator we're dealing with (else we wouldn't be in -redirect- context at all), e.g. `-redirect-2>,'. Random additional comments: If we do stick with hyphens, what does the context look like in the case of completion after: zsh% - 2> (It's perfectly legal syntax to put the redirection anywhere on the line, even before the command for which the precommand modifier is intended.) If we instead switch to commas, what do we do in case of a command named `,'? (I knew people in grad school who used a csh script named that, for reasons too obscure to go into). On a similar note, do we need to fix somehow the existing contexts for completing after the `:' command? Different tack: If I have zsh% ls > with the cursor positioned ON the `>', what context(s) get tried when I press TAB? I might expect it to complete file descriptor numbers ... and in that case, I'd want to complete only the numbers of *valid* file descriptors, but those aren't available to shell functions (yet). -- 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