Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Adding new completions to zsh



Eric Mangold wrote:

> My idea for allowing greater flexibility is to bundle the actual zsh 
> completion functionality as part of the Twisted distribution and give zsh 
> a "stub" that will use the completion functions that are bundled with 
> Twisted.
> 
> Has anyone ever done this before? What do you all think?

It's never been done before but it makes some sense.

Thinking about how this could work, the function distributed with zsh
could start with something like this:

  local dir FPATH="$FPATH"

  dir=${commands[twistd]:h:h}/share/twistd
  if [[ -r $dir/_twistd ]]; then
    fpath=( $dir $fpath )
    autoload -XU
  fi

The dir assignment is a crude way of trying to find the directory
containing the function in the twisted distribution. Hopefully you have
some hook which will do a better job. It then checks if it has found
the function. If so, it adds the directory to beginning of the function
search path and uses autoload to load the replacement function.

After this section, we could fallback on a potentially out-of-date
completion for twistd. It'd be good if the zsh CVS view of that could
be kept reasonably up-to-date though.

Oliver



Messages sorted by: Reverse Date, Date, Thread, Author