zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh User <zsh-users@sunsite.dk>
Subject: Re: dynamic reset of completion widget
Date: Thu, 4 Nov 2004 10:39:29 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.61.0411040902050.5131@toltec.zanshin.com> (raw)
In-Reply-To: <20041104124224.GA9979@let.rug.nl>

On Thu, 4 Nov 2004, Francisco Borges wrote:

> I want to automatically create zsh widgets for python programs using 
> python's standard option parser framework (optparse) and I want also to 
> be able to make and set this widget on-the-fly.

Seems to me the right way to do this would be to define _first to spot 
previously-unknown python scripts and hook them up.  Calling _first is 
already supported in the completion system, but the default implementation 
is a no-op.

E.g.

_first() {
  local command=$words[1]
  if (( CURRENT > 1 )) && [[ -z $_comps[$command] ]]; then
    if [[ $command = *.py ]]; then
      eval "$($command --make-zsh-widget)"
      compdef _$command $command
    fi
  fi
}


      parent reply	other threads:[~2004-11-04 18:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-04 12:42 Francisco Borges
2004-11-04 13:09 ` Peter Stephenson
2004-11-04 20:54   ` Francisco Borges
2004-11-05 12:11     ` Peter Stephenson
2004-11-04 18:39 ` Bart Schaefer [this message]

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=Pine.LNX.4.61.0411040902050.5131@toltec.zanshin.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@sunsite.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).