From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3324 invoked from network); 29 Sep 1997 06:47:58 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 29 Sep 1997 06:47:57 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id CAA21608; Mon, 29 Sep 1997 02:28:52 -0400 (EDT) Resent-Date: Mon, 29 Sep 1997 02:28:52 -0400 (EDT) Date: Mon, 29 Sep 1997 08:29:17 +0200 Message-Id: <9709290629.AA08437@gamma.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@math.gatech.edu In-Reply-To: "Bart Schaefer"'s message of Fri, 26 Sep 1997 12:45:53 -0700 Subject: Re: compctl -Tx 'w[0,...] ...' ... Resent-Message-ID: <"5Kmve3.0.WH5.ZgqBq"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3534 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu "Bart Schaefer" wrote: > > What's the difference between > > compctl ... -- foo > > and > > compctl -Tx 'w[0,foo]' ... > > ?? Aside from the obvious fact that you can use multiple `compctl ...` > commands but only one `compctl -Tx ...`. > > Take a look at this: > > ... > > The above turns every compctl that doesn't use -x (because -x completions > can't be nested) into a single huge compctl -T. (It could probably be > cleaned up a lot, especially the `stuff' loop for unfolding compctls that > happen to have embedded newlines e.g. in -k '(...)' lists.) > > With some finagling, it ought to be possible to rewrite all the compctls > that use -x in a similar manner, eventually reducing the entire collection > of compctls (except for -C and -D) to one `compctl -T`. > > Now you may be wondering, what's the point of all this? Well, at first it > was just a desire to have something like compctl -T but that kicked in only > after everything else failed. (You can almost get this with -D, but only > for commands that don't already have some other completion.) Hm, using flags before a `-x' or `+' with no flags following it (continue with default completion) aren't enough? Could I get an example, please? > Beyond that, > though, it suggests that there may be a lot of redundant functionality in > the completion code, which could without much effort be folded together. > Not that much, only the following lines could be removed: else if (linredir || !(cmd && (((ccp = (Compctlp) compctltab->getnode(compctltab, cmd)) && (compc = ret = ccp->cc)) || ((s = dupstring(cmd)) && remlpaths(&s) && (ccp = (Compctlp) compctltab->getnode(compctltab, s)) && (compc = ret = ccp->cc))))) And doing it that way should be faster than the all in one `-T' version. But I admit that I didn't think of using `-T' with `w[0,...]'... > Also, if you convert all your compctls to one big -T like that, then you > can replace 'w[0,string]' with 'W[0,pattern]' and get an effect that a few > persistent zsh-users have been requesting for some years: pattern matching > on the command name when defining a completion. > Huh? That wouldn't be that difficult to implement (I think) and I don't remember a request for it... Bye Sven -- Sven Wischnowsky wischnow@informatik.hu-berlin.de