From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-users@sunsite.auc.dk
Subject: Re: Getting completion to tell the user what to do
Date: Tue, 20 Jul 1999 09:08:24 +0200 (MET DST) [thread overview]
Message-ID: <199907200708.JAA00727@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Bart Schaefer"'s message of Mon, 19 Jul 1999 17:38:13 +0000
Bart Schaefer wrote:
> This ought to be an easy one in the new 3.1.6 completion system, but I just
> can't get it to work.
>
> I'm trying to complete "subject string goes here" as in
>
> mail -s "subject string goes here"
>
> What I want is to offer no completions at all, because the subject is free-
> form text, but print a hint to the user as to what he's supposed to type.
>
> The following almost works (inside a completion function the rest of which
> is not interesting):
>
> compadd -S '' -X 'Please enter the subject of the message' ''
>
> but because there's a unique completion, the explanation is printed only
> when the user types ^D, and there's no beep to let him know why tab isn't
> doing anything. OK, I thought, I can force a listing:
>
> compadd -S '' -X 'Please enter the subject of the message' ''
> compstate[list]=list
> compstate[force_list]=yes
> compstate[restore]=no
>
> but that doesn't work -- there's still no explanation printed.
>
> 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]=''
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). Then we
can switch of insertion completely.
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.
The -n, of course, is just to be sure that the matches are not visible.
Is that good enough?
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~1999-07-20 7:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-07-20 7:08 Sven Wischnowsky [this message]
1999-07-20 8:53 ` Bart Schaefer
-- strict thread matches above, loose matches on Subject: below --
1999-07-20 9:16 Sven Wischnowsky
1999-07-19 17:38 Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199907200708.JAA00727@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-users@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).