From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15011 invoked from network); 18 Sep 2000 22:08:29 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 18 Sep 2000 22:08:29 -0000 Received: (qmail 887 invoked by alias); 18 Sep 2000 22:07:46 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 3440 Received: (qmail 880 invoked from network); 18 Sep 2000 22:07:45 -0000 Date: Mon, 18 Sep 2000 18:07:40 -0400 Message-Id: <200009182207.SAA06782@soup.ads.apexinc.com> X-Authentication-Warning: soup.ads.apexinc.com: ejb set sender to ejb@apexinc.com using -f From: "E. Jay Berkenbilt" To: schaefer@candle.brasslantern.com CC: zsh-users@sunsite.auc.dk In-reply-to: <1000918172840.ZM29857@candle.brasslantern.com> (schaefer@candle.brasslantern.com) Subject: Re: completion with globbing, take 2 References: <200009171750.NAA05647@soup.ql.org> <1000917184320.ZM19505@candle.brasslantern.com> <200009172303.TAA07756@soup.ql.org> <200009180017.UAA08871@soup.ql.org> <000001c02136$b9c1f2a0$21c9ca95@mow.siemens.ru> <000701c0213d$2434b6d0$21c9ca95@mow.siemens.ru> <000001c02157$2ceaa360$21c9ca95@mow.siemens.ru> <1000918172840.ZM29857@candle.brasslantern.com> Mime-Version: 1.0 (generated by tm-edit 7.106) Content-Type: text/plain; charset=US-ASCII > } Also, after reading the code, I don't believe it is true that _match > } won't do anything without matcher-list set -- see analysis and > } questions below. > > Right, I was confused, as Andrej has already pointed out. (The completion > system has a tendency to do that to almost anyone from time to time, even > Sven.) Actually, I'll admit to being heartened to see others getting confused about this. It is pretty confusing. :-) > On Sep 17, 8:17pm, E. Jay Berkenbilt wrote: > } Subject: completion and globbing, part 2 > } > } It occurred to me that if the analysis in my last message was true, > } the following would work: > [...] > } This does, in fact, give me exactly the behavior I'm looking for > } without using _expand or _match. > > Does it? What happens when you complete a pattern that matches only > directories? (I get, it inserts all the directories and adds a slash > after only the last one, so if I press TAB again I get completions in > that last directory, which seems unlikely to be what you'd want.) Well, in fact, I never do this with rmdir. I chose it as an example only because it's easy to work with and has simple completion functions. I really use this with cvs add and cvs rm where it is great. If I create a bunch of test files, I can do cvs add *TAB and automatically not get the files that are already registered or files that are in .cvsignore. A great timesaver. What I used to do is cvs add `cvs -qn update | fgrep '?' | awk '{print $2}'` (or something like that) which isn't tooo bad but is obviously not as nice as cvs add *TAB. :-) > Incidentally, the three lines > > ret=1 > _complete && ret=0 > return ret > > are equivalent to just > > _complete > return > > and if _complete is the last line in the function, you don't even need > the `return'. Nice to know. So I guess zsh functions are like lisp and perl -- the value of the last statement is the return value -- but with the additional feature that return with no arguments returns the last value.... I'll have to play a bit to see what the real rules are or check the documentation. Over time as I gain more experience in more languages and work with more people's code, I find myself philosophically leaning more toward the Python mentality of making everything explicit, but that's another topic for another forum.... -- E. Jay Berkenbilt (ejb@ql.org) | http://www.ql.org/q/