From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7668 invoked from network); 24 Jan 2003 11:11:40 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 24 Jan 2003 11:11:40 -0000 Received: (qmail 4611 invoked by alias); 24 Jan 2003 11:11:13 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5818 Received: (qmail 4604 invoked from network); 24 Jan 2003 11:11:13 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 24 Jan 2003 11:11:13 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [212.125.75.12] by sunsite.dk (MessageWall 1.0.8) with SMTP; 24 Jan 2003 11:11:12 -0000 X-VirusChecked: Checked X-Env-Sender: kiddleo@logica.com X-Msg-Ref: server-6.tower-4.messagelabs.com!1043406673!18134 Received: (qmail 22553 invoked from network); 24 Jan 2003 11:11:13 -0000 Received: from iris.logica.co.uk (158.234.9.163) by server-6.tower-4.messagelabs.com with SMTP; 24 Jan 2003 11:11:13 -0000 Received: from finches.logica.co.uk ([158.234.142.11]) by iris.logica.co.uk (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id LAA04625; Fri, 24 Jan 2003 11:10:37 GMT X-Authentication-Warning: iris.logica.co.uk: Host [158.234.142.11] claimed to be finches.logica.co.uk Received: from finches.logica.co.uk (localhost [127.0.0.1]) by finches.logica.co.uk (8.11.6/8.11.6/SuSE Linux 0.5) with ESMTP id h0OBCmE01717; Fri, 24 Jan 2003 12:12:51 +0100 cc: zsh-users@sunsite.dk In-reply-to: <8yxj3oiq.fsf@ID-23066.news.dfncis.de> From: Oliver Kiddle References: <8yxj3oiq.fsf@ID-23066.news.dfncis.de> To: clemens fischer Subject: Re: bash convert: new completion system skeleton? Date: Fri, 24 Jan 2003 12:12:48 +0100 Message-ID: <1715.1043406768@finches.logica.co.uk> Sender: kiddleo@logica.com On 17 Jan, you wrote: > hi. > > i have lots of bash completers for my daily needs that i can't live > without. but bash-style completers resemble zsh's old completion > style, which is inferiour to zsh's new system. > > my completers have the following properties: the program which's > arguments have to be completed have some help or list function which > i can use to enumerate the possible completions, then i just grep(1) > out the likely candidates. > similiar code exists for gnu-make, autoconf's configure, openssl etc. zsh has all of these (except openssl) and a lot more besides already written. If you've done: autoload -U compinit; compinit they should work automatically. > could somebody please offer the skeleton of a completer for the new > system, complete with which share/zsh/4.0.6/function/_s to > call, how to name the zstyle and the contexts? To convert your bash completion for zsh, at a simple level, all you should need to do is change the $COMP_WORDS variable to $words, $COMP_CWORD to $CURRENT and perhaps a few others. Bash returns the matches in the $COMPREPLY array whilst zsh uses a builtin - compadd. So putting: compadd - "${COMPREPLY[@]}" at the end of your bash function will handle that. > i'm simply lost in all the files of the distribution, especially > those _ functions. any pointers appreciated. is there The helpers are just a better way of doing what bash does with the compgen builtin. You just call _users to complete usernames or _files to complete files. Much more readable than `compgen -f' and much more powerful when you look in more detail. I could easily write a function to allow zsh to use completions written for bash: local COMP_REPLY local COMP_CWORD=$CURRENT local -a COMP_WORDS COMP_WORDS=( $words ) setopt localoptions emulate sh "$@" compadd - "${COMPREPLY[@]}" Would be enough for _qconfirm (I think). Would that be useful? Or do we have a perl guru who can write a program to convert the function? Of course it is better to rewrite the functions properly to make full use of zsh's greater power. Oliver This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.