From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8712 invoked from network); 11 Mar 2002 11:17:53 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 11 Mar 2002 11:17:53 -0000 Received: (qmail 13524 invoked by alias); 11 Mar 2002 11:17:48 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 16799 Received: (qmail 13513 invoked from network); 11 Mar 2002 11:17:48 -0000 From: Sven Wischnowsky MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15500.37377.808155.293654@wischnow.berkom.de> Date: Mon, 11 Mar 2002 12:16:17 +0100 To: zsh-workers@sunsite.dk Subject: Re: Redirection completion In-Reply-To: <3922.1015844089@csr.com> References: <15500.28153.769884.199234@wischnow.berkom.de> <3922.1015844089@csr.com> X-Mailer: VM 6.95 under 21.5 (patch 3) "asparagus" XEmacs Lucid Peter Stephenson wrote: > Sven Wischnowsky wrote: > > So, I wrote the patch below. Removing the -T stuff and consistently > > using names like `-value-foo' or `-redirect-echo-2>' everywhere, both > > for the context used for styles and for compdef/#compdef (that's why > > we don't need separated sets of completion functions anymore). > > This makes a lot of sense. Good. > I haven't quite understood how this system > handles the difference between `-redirect-2>' and `-redirect-echo-2>'. > Suppose I defined a redirection for the former, will I still get a > context including `-redirect-echo-2>'? And is that the same for a plain > `-redirect-'? I would guess yes, since the context depends on what you > are completing rather than what function is doing it (and patterns are a > more natural part of styles than of compdef definitions). The functions calling _dispatch give it a bunch of string that are to be looked up in order until one with a defined function is found. And, in this case, _redirect makes sure to give first `-redirect-echo-2>', then `-redirect-2>'. So you can define a special version for echo and another one for completion after `2>' everywhere else. _dispatch adds to this the context `-default-' preceded by the prefix it was given, so default redirection completion is defined by `-redirect--default-', which is what is now in _files. _redirect itself is still in charge of the context -redirect- itself. > The only worry is that someone, somewhere will decide it's a great idea > to have commands beginning with `-' for some special use. I don't see > how we can guard against that in general, though. We can't make the > current set of completion functions indendent of the choice of > character. We may just as well stick with -. Maybe we could allow it > to be escaped, like `:' (often) can be. Hm, yes, although having to quote a hyphen looks weird. I would have suggested usin `|' if that weren't a pattern matching character. Safer would be `;' but that looks too much like a colon for my taste. Maybe use a comma? Bye Sven -- Sven Wischnowsky wischnow@berkom.de