zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: _look
Date: Fri, 5 May 2000 13:55:57 +0200 (MET DST)	[thread overview]
Message-ID: <200005051155.NAA00695@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Tanaka Akira's message of 05 May 2000 20:31:26 +0900


Tanaka Akira wrote:

> This is a completion function for `look'.  It calls `look' itself to
> find completions.
> 
> Apart from that, I found that some functions using a state of
> _arguments such as _gzip declare `curcontext' instead of `context'
> which is specified by zshcompsys(1).  Is `curcontext' obsolete?

No. Functions should either

- Call _arguments as in _gzip, make `context' local and in the
  state-handling make sure that $context is used in the argument field 
  of the context name. This is what functions like _tags do when given 
  the -C option, so:

    local context state line
    typeset -A opt_args

    _arguments '...:->foo' && return 0

    if [[ "$state" = foo ]]; then
      _tags -C "$context"
      ...
    fi

  (That `&& return 0' is missing in _gzip, too.)
  Actually, $state and $context nowadays are arrays, because
  _arguments may return more than one state, but that's only possible
  if the specs make it possible that more than one argument may be
  completed in some place.

- Call _arguments with the -C option and then make `curcontext' local, 
  initialising it to itself, as is done in _gzip. In that case
  _arguments will modify $curcontext without making it local to itself 
  so that the state-handling code doesn't need to care about setting
  up the context. Of course, this only works if only one state can be
  returned by _arguments. This was the case for all completion
  functions when I added the multi-state handling to _arguments.

In other words, there is a `-C' missing in _gzip (and probably in
other functions?).

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


             reply	other threads:[~2000-05-05 11:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-05 11:55 Sven Wischnowsky [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-05-05 11:31 Tanaka Akira

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=200005051155.NAA00695@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --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).