From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6629 invoked from network); 9 Jan 2003 16:02:14 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 9 Jan 2003 16:02:14 -0000 Received: (qmail 27080 invoked by alias); 9 Jan 2003 16:01:59 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5659 Received: (qmail 27062 invoked from network); 9 Jan 2003 16:01:59 -0000 From: Borzenkov Andrey To: "'Phil Pennock'" , zsh-users@sunsite.dk Subject: RE: Completion of dirs confused over cursor position Date: Thu, 9 Jan 2003 19:01:50 +0300 Message-ID: <6134254DE87BD411908B00A0C99B044F03A0B5D2@MOWD019A> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.4510 In-Reply-To: <20030109160645.GA22637@globnix.org> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 > On 2003-01-09 at 18:02 +0300, Borzenkov Andrey wrote: > > function _foo { > > _files -W /some/directory > > } > > compadd _foo commandname > > > > does it work? >=20 > No: > compadd: can only be called from completion function >=20 compdef. Shame on me :( bor@itsrm2% compdef _foo foo bor@itsrm2% function _foo { _files -W ~/test } bor@itsrm2% foo a\ b/ Completing file a\ b/ c\\\ d/ radius/ uudecode/ > However, that's looking much simpler than anything in the manual = pages > or the examples I looked at in the distributed completions. :^) I = was > getting lost in functions calling functions calling functions > maintaining various levels of state, with reference man-pages and no > tutorial. >=20 > Is there a tutorial somewhere which I've missed?=20 http://zsh.sunsite.dk/Guide/ The manual pages are > some of the most daunting I've seen. I do read manual-pages, but > looking at these I can't get a mental handle on the frameword and = what > fits where, to get started. >=20 what we need is splitting current documentation into development guide = and user stuff. Completion manual pages are more of the former but they = lack too much to be of any real use. And average user needs mostly just = _arguments, _files and possibly _values to generate own completions and exactly = these have to poor documentation (and nightmare syntax :)). -andrej > > And doing it automatically: > > > > echo > ~/functions/_foo << EOF > > #compadd commandname > > _files -W /some/directory > > EOF >=20 > That general structure I had (although I suspect that you meant cat, > since echo doesn't use its stdin). Urgh :)) And the supplied versions use > "#compdef". If I use "#compadd", it's not auto-loaded. >=20 > > fpath=3D($fpath ~/functions) > > compinit >=20 > And that I had. >=20 > > the last part obviously goes into .zshrc or whatever. Try running > > compinstall as well. >=20 > Yup, tried that. >=20 > Okay, logging in again, forcing a rebuild of .zcompdump (after = changing > to "#compdef", it now works. :^) >=20 > Thanks, >=20 > -Phil