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

Re: Rough Draft of Article on Writing Completion Functions



John Beppu wrote:
> The one source of information that had a chance to get it right was
> the I<Zsh User's Guide>.  It provides many examples followed by
> explanations, but what it lacks is an example that takes a command
> and then writes a completion function for it, from start to finish.
> It also starts talking about some very advanced material without
> preparing the reader for this onslaught.  However, it is a living
> document, so let's hope that it matures and grows sensitive to what
> people really want from such a document so that it can effectively
> satisfy those needs.

It's probably worth pointing out it's not going to change at all without
more specific suggestions.  So far I have had no suggestions about
structural changes whatsoever.

I deliberately didn't write a whole real-world completion function
because there are already so many to look at, I just explained the
possibilities.  But if you can think of a good example you think is
missing I'll add it.

> The great tragedy of Zsh is that they actually made it very easy to
> write completion functions, but you'd never know it by just
> reading the documentation.

Hmm...  how much simpler than

  _foo() { compadd Yan Tan Tethera; }
  compdef _foo foo

do I need to get?  This is the sort of hint I need from the puzzled.

> [ BEGIN SIDEBAR 2 - A Public Service Announcement ]
> 
> For those of you just joining us, Zsh has quite the completion
> system.  Your tab key will have answers to practically everything if
> you put the following in your I<.zshrc> and start up I<zsh>.
> 
> C<
> autoload -U compinit
> compinit
> >
> 
> Try running C<compinstall>, too.  It will let you interactively
> configure the behaviour of the completion system.

I suggest you mention that you need zsh 4.0.x as a matter of priority,
regardless of space limitations, or some people are going to get
confused --- there must be a great many 3.0.x versions still around from
older distributions.  (Maybe you said that in a previous article, but
even so people picking up just this one really need to know.)  I know
there are a few Mandrake distributions with 3.1.x versions which are
probably good enough, but it's been changing so fast I would recommend
someone starting from scratch to make sure they have a 4.0 release.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 392070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************



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