From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15042 invoked from network); 28 Mar 2002 17:01:56 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 28 Mar 2002 17:01:56 -0000 Received: (qmail 23841 invoked by alias); 28 Mar 2002 17:01:49 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 16923 Received: (qmail 23828 invoked from network); 28 Mar 2002 17:01:48 -0000 X-VirusChecked: Checked Date: Thu, 28 Mar 2002 17:01:19 +0000 From: Oliver Kiddle To: Sven Wischnowsky Cc: zsh-workers@sunsite.dk Subject: Re: adding the original string as a completion match Message-ID: <20020328170119.GA29498@logica.com> References: <20020327111020.GA15630@logica.com> <15522.60735.419805.36569@wischnow.berkom.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <15522.60735.419805.36569@wischnow.berkom.de> User-Agent: Mutt/1.3.27i Sender: Oliver Kiddle Sven Wischnowsky wrote: > Something like _all_matches is problematic because whether menu > completion is to be used is decided very late, after all the > completers have been called. It would be easier to add a style tested > by _main_complete itself saying whether the original string should be > added as a match or only as a description. Other function could Looking at where in _main_complete I would need to add this, it seems that it could be done with a post function setup from a completer which would be like _all_matches. Your suggestion is probably better though. I tried this: if [[ $compstate[insert] = *menu* && "$compstate[nmatches]" -gt 1 && -n $PREFIX$SUFFIX ]]; then _description -V original expl original compadd "$expl[@]" -U -Q - "$PREFIX$SUFFIX" fi There needs to be more things in the if condition though. In particular, it has problems when the matches added are added after part of PREFIX will have been moved to IPREFIX, e.g. cd Mail/ results in the slash being removed. Any idea on how to get it working or if it is even possible? If not, I'll commit the _match change instead. > > And another question, is there any way with _all_matches that I can get > > it to just insert all the matches and never list all the things which > There should be a possibility for this by setting compstate[insert]=-1 > after _all_matches added that all-matches-match. Haven't tried, > though... That didn't seem to work but compstate[insert]=all does the job. Hence the following patch. Thanks Sven. Oliver Index: Completion/Base/Completer/_all_matches =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Base/Completer/_all_matches,v retrieving revision 1.1 diff -u -r1.1 _all_matches --- Completion/Base/Completer/_all_matches 2 Apr 2001 11:05:27 -0000 1.1 +++ Completion/Base/Completer/_all_matches 28 Mar 2002 16:53:05 -0000 @@ -33,8 +33,12 @@ if [[ "$compstate[nmatches]" -gt 1 && $not[(I)(|_)$_completer] -eq 0 ]]; then local expl - _description all-matches expl 'all matches' - compadd "$expl[@]" -C + if zstyle -t "$_all_matches_context" insert; then + compstate[insert]=all + else + _description all-matches expl 'all matches' + compadd "$expl[@]" -C + fi fi unset _all_matches_context Index: Doc/Zsh/compsys.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v retrieving revision 1.152 diff -u -r1.152 compsys.yo --- Doc/Zsh/compsys.yo 27 Mar 2002 16:10:11 -0000 1.152 +++ Doc/Zsh/compsys.yo 28 Mar 2002 16:53:06 -0000 @@ -1461,6 +1461,11 @@ tt(EXTENDED_GLOB) option is in effect, so the characters `tt(#)', `tt(~)' and `tt(^)' have special meanings in the patterns. ) +kindex(insert, completion style) +item(tt(insert))( +This style is used by the tt(_all_matches) completer to decide whether to +insert the list of all matches instead of adding it as another match. +) kindex(insert-ids, completion style) item(tt(insert-ids))( When completing process IDs, for example as arguments to the tt(kill) and -- This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.