From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13067 invoked from network); 18 Sep 2000 18:09:23 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 18 Sep 2000 18:09:23 -0000 Received: (qmail 24186 invoked by alias); 18 Sep 2000 18:08:29 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 3439 Received: (qmail 24179 invoked from network); 18 Sep 2000 18:08:28 -0000 X-Envelope-Sender-Is: Andrej.Borsenkow@mow.siemens.ru (at relayer goliath.siemens.de) From: "Andrej Borsenkow" To: Subject: RE: completion with globbing, take 2 Date: Mon, 18 Sep 2000 22:08:24 +0400 Message-ID: <000401c0219b$6fc3e310$21c9ca95@mow.siemens.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <1000918172840.ZM29857@candle.brasslantern.com> X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Importance: Normal > > On Sep 18, 10:53am, Andrej Borsenkow wrote: > } Subject: RE: completion and globbing, part 2 > } > } Well, what you've effectively done is to write stripped-down version of > } _match :-) > > Not quite; he's written a stripped-down version of "_expand with the > completions style defaulted to true, followed by _match". > I tentatively disagree. The main difference between _expand and _match is who generates matches. Completion aside, _expand generates "matches" (that are actually expansions in this case) itself. _match takes all possible completions and tries to match them against given pattern. See the difference? To write stripped-down version of _expand means something like (for globbing only) foo=($~CURRENT) compadd -- "$foo" As I wrote, it is just a coincidence that file completion is using the same pattern from command line, hence _expand and _match look alike. BTW thank you all for finally making it clear to me :-))) > } Could you consider patching _match adding a style to control it? > > The most obvious thing would be to have _match itself recognize the > completions style. > Is is not enough. See later. > } But _match just modifies behaviour of subsequent completer ... > > Eh? It *calls* _complete. How is that modifying subsequent completers? > Eh ... I meant that, actually. I had in mind this difference between _expand and _match as described above. > > You have to remember to provide the standard completion-system setopts > in any wrapper around the supplied completer functions. > > _insert_all_matches () { > setopt localoptions nullglob rcexpandparam extendedglob noshglob > unsetopt markdirs globsubst shwordsplit nounset ksharrays > compstate[insert]=all > compstate[old_list]=keep > _complete > } > > (Speaking of which, there's nullglob in the list. Who was it who added > (N) to all those glob patterns in several functions?) > Sven in zsh-workers/12768 > } But, as stated, it has all sorts of problems. It does not work > correctly after > } *completion* - it tries to complete word already inserted (that is, it is > } treated as new completion instead of continuation of old - but this may be > } related to my styles settings). > > Hmm ... can you give an example of what you see that you think is wrong? > It seems OK to me (and I'm curious which of your styles might botch it). > I had in mind interaction between _oldlist and _match. When you have a pattern and press TAB first time, you get a list. When you press TAB second time, completion system tries to reuse this old list instead of taking current word and trying to complete it (assuming proper style setup - but, may be, it is even default). So, somehow I expected currently inserted word to be replaced with all matching completions (and compstate[oldlist]=keep was exactly for that). But I am not even sure, if it possible. O.K. about adding completions style to _match. Note, that if completions style is set for _expand it just calls _complete. If it generated any matches, _expand just exits. If no matches were generated, it does it itself and now has full control over possible tags. But what we actually need, is to get completions that _complete just generated, together with all tags, descriptions and whatever else, and add to them e.g. "all matches" tag. And that while preserving all user settings for verbose, tag ordering etc etc etc. Something like compstate[pattern_match]=\* if _complete; then if _requested all-matches ... then all_matches=??? # gets all generated matches compadd ... -- "$all_matches" fi fi Hmm ... actually, quite possible. Assuming, that we can get all matches. -andrej