From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7124 invoked from network); 24 Jan 2003 09:42:51 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 24 Jan 2003 09:42:51 -0000 Received: (qmail 9906 invoked by alias); 24 Jan 2003 09:42:27 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5815 Received: (qmail 9899 invoked from network); 24 Jan 2003 09:42:27 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 24 Jan 2003 09:42:27 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [80.91.224.249] by sunsite.dk (MessageWall 1.0.8) with SMTP; 24 Jan 2003 9:42:27 -0000 Received: from root by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 18c0K5-0005na-00 for ; Fri, 24 Jan 2003 10:40:29 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: zsh-users@sunsite.dk Received: from news by main.gmane.org with local (Exim 3.35 #1 (Debian)) id 18ZWZw-00055K-00 for ; Fri, 17 Jan 2003 14:30:36 +0100 From: clemens fischer Subject: bash convert: new completion system skeleton? Date: Fri, 17 Jan 2003 14:16:13 +0100 Message-ID: <8yxj3oiq.fsf@ID-23066.news.dfncis.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@main.gmane.org User-Agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.3.50 (i386-unknown-freebsd4.6.2) Cancel-Lock: sha1:1WRfV6hoTv7yMTwL+2/7Km0dIZo= Sender: news 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. example: there's an anti-spam system called qconfirm , the bash completer for which is: _qconfirm () { local i cur qopts qcmd COMPREPLY=() qopts="" qcmd=${COMP_WORDS[1]} # collect possible options to hand over 1:1 for (( i=1 ; i<=COMP_CWORD ; i++ )) do cur="${COMP_WORDS[$i]}" #echo $cur >&2 case $cur in -*) qopts="$qopts $cur" ;; *) qcmd=${cur} break ;; esac done # select the database depending on the subcommand used case $qcmd in ac*|b[ao]*|dr*) which=pending ;; re*|pe*) which=ok ;; *) which=ok ;; esac # here's the meat: list the relevant database and pick the # right completion cur=${COMP_WORDS[COMP_CWORD]} COMPREPLY=( $(qconfirm $qopts list "${which}" | cut -d" " -s -f2 | egrep -i "${cur}" )) return 0 } # tell the completion system which function is responsible for qconfirm complete -F _qconfirm qconfirm similiar code exists for gnu-make, autoconf's configure, openssl etc. 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? i'm simply lost in all the files of the distribution, especially those _ functions. any pointers appreciated. is there already a wiki for zsh specialists and users? clemens