From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 808 invoked from network); 18 Feb 2000 09:39:28 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 18 Feb 2000 09:39:28 -0000 Received: (qmail 3796 invoked by alias); 18 Feb 2000 09:39:21 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9788 Received: (qmail 3788 invoked from network); 18 Feb 2000 09:39:21 -0000 Date: Fri, 18 Feb 2000 10:39:19 +0100 (MET) Message-Id: <200002180939.KAA30810@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Tanaka Akira's message of 18 Feb 2000 08:33:10 +0900 Subject: Re: PATCH: Re: completion after ../ Tanaka Akira wrote: > > Or maybe we write a completer (a real, top-level completer) that > > registers a post-completion function which checks if there are only > > alternate matches (or only one alternate match) and no normal one and, > > if this is the case, makes a list be shown instead of the match(es) be > > used. That would be quite easy (set compstate[insert]='', > > compstate[list]='list force'), , but I'm not sure if this is enough or > > the right thing at all. > > I tried this and I found it's enough for me. Of course, I agree that > it's quite inconsistent behaviour and it shouldn't be default. > > So I want to insert following fragment at last in _main_complete. > > if zstyle -b ":completion:..." && > [[ $compstate[old_list] != shown && > $compstate[nmatches] = 0 && > $compstate[alternate_nmatches] = 1 ]]; then > compstate[insert]='' > compstate[list]='list force' > fi > > What's a proper context and a style? I couldn't find them. (Btw. testing for the truth value of a style is done with -t (default if style is unset: false) or -T (default: true).) Well, I'd suggest the normal context with an empty tag as in ":completion:${curcontext}:". I have problems finding a good style name myself (`show-only-list-if-only-one-alternate-match-and-no-normal-one' is probably a tiny bit too long). Hm. Maybe something like `show-single-alternate' or, probably better, `show-single-ignored' (because they `come' from styles named like `ignored-patterns'). Or we name it `single-ignored' (yes, there must be a better name) and enhace it: if it's set to `show' we use the above. If it's set to `menu' we also add the string from the line in the alternate set (as usual, with -S '', in it's own group, with a call to _description and so on...) and start menu-completion (compstate[insert]=menu). We should also do that before the test in line 83 which I changed some days ago so that the user-requested menu-style (especially if (s)he selected menu-selection) is respected (and the test in line 83 should be changed to make it be used if the style we are talking about is set to `menu' -- but not in normal completion if there is no or only one match). Bye Sven -- Sven Wischnowsky wischnow@informatik.hu-berlin.de