zsh-workers
 help / color / mirror / code / Atom feed
From: Felix Rosencrantz <f_rosencrantz@yahoo.com>
To: zsh-workers <zsh-workers@sunsite.auc.dk>
Subject: Completing parameter names that have yet to be set.
Date: Thu, 10 Aug 2000 23:30:09 -0700 (PDT)	[thread overview]
Message-ID: <20000811063009.9319.qmail@web1104.mail.yahoo.com> (raw)

Since there is some talk about parameter completion...  I've had a
custom version of _parameter for some time that I've been meaning to
document and submit.  The customization was that it could complete
parameters that were not yet set.  Using a style, the user specifies a
list of parameters that they want zsh to know about to complete.

For example, with the zsh distribution there is the TESTNUM environment
variable, which can be used to specify a subset of the zsh tests when
running "make check" . However, most of the time this environment
variable is unset.  I can't always remember the special variable.  So
it's nice that zsh completion can.

I think it would be useful if the style specification allowed for descriptions
of these parameters.  The descriptions could be used for parameters that
are already set.  Though I'm not sure how to do this (with _values?).

I've included a copy of what I've got so far.  No docs, and currently
out-of-date with respect to Oliver's changes.  And not fully tested.  It
works for me, though.  I wasn't sure if _alternative could be used here.
Also, it doesn't allow for descriptions of the parameters.  Also, to be
even more complete I guess type information could be provided to be used
in conjunction with the -g flag Oliver just added.  Anyone is welcome to
take this code or idea and add it in.  I haven't done much with it in a
while.

It seems like the ability to tell zsh of words that can't be found by
querying the system (e.g. these parameter names, files that don't exist
yet, etc. ) would be useful.  I was thinking that it would be useful
to add some generic code that would (maybe a completer). Maybe using
the new cache system. The code would allow the user to specify a set of
words to be tossed in with the words that standard completion functions
complete.  I'm not sure what would be a good solution.  This is more
meant to provoke some response/thought by the completion gurus.  

-FR.

#autoload

# This should be used to complete parameter names if you need some of the
# extra options of compadd. It completes only non-local parameters.

local expl extraparams unsetparams p existparams

zstyle -a ":completion:${curcontext}:" parameter-list extraparams

unsetparms=()
for p in $extraparams ; do 
        if [[ $+parameters[$p] -ne 1 ]] ; then
                unsetparams=($unsetparams $p)
        fi
done

existparams=(${(qk)parameters[(R)^*local*]})
_alternative \
        "parameters:parameters already set:{compadd ${(q)@} - $existparams }" \
        "unset-parameters:parameters not already set:{compadd ${(q)@} -
$unsetparams}"


__________________________________________________
Do You Yahoo!?
Kick off your party with Yahoo! Invites.
http://invites.yahoo.com/


             reply	other threads:[~2000-08-11  6:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-08-11  6:30 Felix Rosencrantz [this message]
2000-08-11  7:54 Sven Wischnowsky
2000-08-14  5:51 Felix Rosencrantz
2000-08-14  7:15 ` Bart Schaefer
2000-08-14  8:01 Sven Wischnowsky
2000-08-14  8:03 Sven Wischnowsky
2000-09-06  7:00 Felix Rosencrantz
2000-09-06  7:41 Sven Wischnowsky

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=20000811063009.9319.qmail@web1104.mail.yahoo.com \
    --to=f_rosencrantz@yahoo.com \
    --cc=zsh-workers@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).