From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12334 invoked from network); 20 Jul 1999 09:16:38 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 20 Jul 1999 09:16:38 -0000 Received: (qmail 26922 invoked by alias); 20 Jul 1999 09:16:13 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 2456 Received: (qmail 26915 invoked from network); 20 Jul 1999 09:16:12 -0000 Date: Tue, 20 Jul 1999 11:16:06 +0200 (MET DST) Message-Id: <199907200916.LAA01365@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-users@sunsite.auc.dk In-reply-to: "Bart Schaefer"'s message of Tue, 20 Jul 1999 08:53:51 +0000 Subject: Re: Getting completion to tell the user what to do Bart Schaefer wrote: > On Jul 20, 9:08am, Sven Wischnowsky wrote: > } Subject: Re: Getting completion to tell the user what to do > } > } Bart Schaefer wrote: > } > } > What I want is to offer no completions at all [...] > } > but print a hint to the user as to what he's supposed to type. > } > > } > What obvious thing have I forgotten/overlooked here? Is there an entirely > } > better alternative to using compadd -X ? > } > } Time for dirty tricks: > } > } compadd -UX 'Please...' -n '' > } compstate[insert]='' > > Oho -- undocumented dirty tricks, no less. The compstate[insert] doc > doesn't give any hint that it can be set but empty. Of which case that > is documented is this a degenerate? Unsetting compstate[insert]. > } compstate[list]=list > } compstate[force_list]=yes > } > } You need the -U because otherwise the empty string never matches > } what's on the line (not even the empty string on the line). > > Really? When I first tried > > compadd -X 'Please ...' '' > > (without the -S) then every time I pressed TAB a single space got inserted > (the suffix). If the empty string isn't a match, why did that happen? Ugh, right, sorry. > } Then we can switch off insertion completely. > > So that's what compstate[insert]='' means? Exactly that. > } If you want the string to be listed only on a TAB with an empty string > } you can do `compadd -X "Please..." -n dummy' -- i.e. add a string with > } matching. > > Presumably then "dummy" should be something that can't possibly match? > Or does that not matter? That would be better, yes. Unless you also have `compstate[insert]=""' or `unset "compstate[insert]"', in which case it doesn't matter. > } The -n, of course, is just to be sure that the matches are not visible. > } > } Is that good enough? > > It's just marvelous, thanks. One question, though -- I thought that we > made kill-whole-line erase the completion listing, but it doesn't seem to > do that in this case: > > zagzig% mail -s > > leaves me with > > zagzig% > Please enter a descriptive subject > > which is rather annoying when I start in typing some completely different > command and doing completions for it that don't themselves produce a list. Nasty side-effect of 7161. Bye Sven diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c --- os/Zle/zle_tricky.c Tue Jul 20 10:42:27 1999 +++ Src/Zle/zle_tricky.c Tue Jul 20 11:08:31 1999 @@ -6743,8 +6743,9 @@ listmatches(); if (validlist) freematches(); - lastambig = menucmp = menuacc = validlist = showinglist = - fromcomp = listshown = 0; + lastambig = menucmp = menuacc = validlist = showinglist = fromcomp = 0; + if (listshown < 0) + listshown = 0; minfo.cur = NULL; minfo.asked = 0; compwidget = NULL; diff -u od/Zsh/compwid.yo Doc/Zsh/compwid.yo --- od/Zsh/compwid.yo Mon Jul 19 15:54:31 1999 +++ Doc/Zsh/compwid.yo Tue Jul 20 11:14:45 1999 @@ -236,7 +236,8 @@ behaviour of the tt(MENU_COMPLETE) or tt(AUTO_MENU) options, respectively, is to be used. -On exit it may be set to any of the values above, or to a number, in which +On exit it may be set to any of the values above (where setting it to +the empty string is the same as unsetting it), or to a number, in which case the match whose number is given will be inserted into the command line. It may also be set to a string of the form `var(group):var(match)' which specifies a match from a group of matches to be inserted, counting from 1 -- Sven Wischnowsky wischnow@informatik.hu-berlin.de