From: Peter Stephenson <pws@ifh.de>
To: zsh-workers@math.gatech.edu (Zsh hackers list)
Subject: Re: User-defined completion listing
Date: Thu, 20 Nov 1997 10:22:29 +0100 [thread overview]
Message-ID: <199711200922.KAA06895@sgi.ifh.de> (raw)
In-Reply-To: ""Bart Schaefer""'s message of "Wed, 19 Nov 1997 11:41:50 MET." <971119114150.ZM1710@candle.brasslantern.com>
"Bart Schaefer" wrote:
> } compctl ... -Y '$array'
> } or
> } compctl ... -Y 'func'
>
> I must confess confusion as to why you'd do it this way.
>
> If you're going to examine the first character and behave differently
> when it is '$', you could do that with -X and not need a new option.
-X doesn't do the right thing. It gets displayed with completions,
if there's no unique match, not just listings. Further, it gets displayed
in addition to a listing, just above. We want something to be displayed
instead of a listing. If you simply use -X, there's no way of adapting
the listing at all, and it would be wrong to misuse -X for that
purpose. Also, -Y *has* to be generated separately for each
completion, because it depends on the actual list; -X doesn't, so
there's no real rationale for making it support $var.
> If you're going to expand a variable, why does it have to be an array?
> The parameter to -X is just a string.
Because -Y replaces a list; it's natural to generate the replacement
list as an array. As with literal arrays (quoted below), I'd quite
like to alter get_user_var() to turn a scalar into a single element
array, which will solve this problem quite neatly, it just wasn't
a necessary part of yesterday's patch. I certainly agree it's
desirable.
> If you're going to substitute a string, why pass it around with $reply?
I don't understand this. The $reply comes only from the function.
The exact $reply array is used for the listing. There is no more
substitution and $reply has always been for communication back from
functions. Do you mean `why not use $REPLY'? The answer is because
you can't replace a complete listing with that. It seems silly
to use both.
In more abstract terms, what gets displayed in a completion listing
is always an array of possibilities. The whole point of the -Y option
is to allow you to alter that. It is entirely natural that this altered
list would be an array. It just so happens you can get away with a one
element array with everything stuck together, if you want.
> } Another thing under the `could perhaps be better, but it's time I did
> } some work' heading: literal arrays are allowed as with -k, i.e. -Y
> } '(option1 option2 ...)', but there's no way of getting a literal
> } string there.
>
> Why do you need to pass a literal string to -Y when you can use -X ?
You can't, not for the same thing. See above. -X and -Y are
entirely different: -X gives a single, fixed banner heading for
the listing and for the completion; -Y gives a list of completions
to replace the ones shown when displaying completions.
--
Peter Stephenson <pws@ifh.de> Tel: +49 33762 77366
WWW: http://www.ifh.de/~pws/ Fax: +49 33762 77413
Deutsches Elektronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, Platanenallee 6, 15738 Zeuthen, Germany.
next prev parent reply other threads:[~1997-11-20 9:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-11-19 17:00 PATCH: " Peter Stephenson
1997-11-19 19:41 ` Bart Schaefer
1997-11-20 9:22 ` Peter Stephenson [this message]
1997-11-20 13:39 ` PATCH: allow scalars as completion variables Peter Stephenson
1997-11-20 16:57 ` User-defined completion listing Bart Schaefer
1997-11-21 9:26 ` Peter Stephenson
1997-11-21 18:39 ` Bart Schaefer
1997-11-27 10:10 ` PATCH: completion lists revisted Peter Stephenson
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=199711200922.KAA06895@sgi.ifh.de \
--to=pws@ifh.de \
--cc=zsh-workers@math.gatech.edu \
/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).