From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21666 invoked from network); 17 Sep 2003 16:30:48 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 17 Sep 2003 16:30:48 -0000 Received: (qmail 12377 invoked by alias); 17 Sep 2003 16:30:43 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 19097 Received: (qmail 12368 invoked from network); 17 Sep 2003 16:30:43 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 17 Sep 2003 16:30:43 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [4.64.232.255] by sunsite.dk (MessageWall 1.0.8) with SMTP; 17 Sep 2003 16:30:42 -0000 Received: (from schaefer@localhost) by candle.brasslantern.com (8.11.6/8.11.6) id h8HGUfg05853 for zsh-workers@sunsite.dk; Wed, 17 Sep 2003 09:30:41 -0700 From: Bart Schaefer Message-Id: <1030917163041.ZM5852@candle.brasslantern.com> Date: Wed, 17 Sep 2003 16:30:41 +0000 In-Reply-To: <20030917083752.GC4415@DervishD> Comments: In reply to DervishD "Re: Tags in function files" (Sep 17, 10:37am) References: <20030916203559.GA2160@DervishD> <18188.1063784897@gmcs3.local> <20030917083752.GC4415@DervishD> X-Mailer: Z-Mail (5.0.0 30July97) To: Zsh Subject: Re: Tags in function files MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Sep 17, 10:37am, DervishD wrote: } } OK, thanks :) BTW, the special parameters as 'words' and the } like, are too created and initialized by compinit (I mean, the new } completion system...)? No, those are set up by the ZLE internals. However, they're provided only to "completion widgets", which means those created with "zle -C" (as opposed to those created with "zle -N"). The new completion system (there's been a half-hearted attempt to start using "compsys" to refer to this, to distinguish from "compctl" without having to write a whole paragraph like this one ... I'm tempted to write and document a function named "compsys", or at least put an index entry with that name into the docs) is an extensive example of what can be accomplished with "zle -C" plus the "compadd" builtin. The really short summary is that "zle -C" tells zsh how to display the results computed by your widget, and "compadd" from within the widget tells zsh what those results are. Then for finer control you can get into playing with the values of the "compstate" parameter. You probably got all that already from PWS's user guide, intro to chapter 6. } $words doesn't seem to work, so I'm thinking about using 'BUFFER' for } command line parsing in order to call one of the completion functions } I need. Like _main_complete, but lots simpler. Keep in mind that one of the things _main_complete does is reset a whole lot of setopts to be sure that all completion functions operate in the same syntactic environment. If, for example, you setopt KSH_ARRAYS, then the behavior of things like $words won't match the compsys documentation. A handy debugging tool for widgets of any sort is "zle -M". E.g.: zagzig% bung() { function> zle -M "words: $words" function> compadd $words[1] function> } zagzig% zle -C bung-word .complete-word bung zagzig% bindkey ^XB bung-word zagzig% foo If I hit C-x B at this point I see: zagzig% foo foo words: foo If I then type a "g" and hit C-x B again I get a beep (because "g" can't be matched to the compadd'd match "foo") and see: zagzig% foo foo g words: foo foo g