From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3528 invoked from network); 28 Jul 2004 03:06:29 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 28 Jul 2004 03:06:29 -0000 Received: (qmail 18522 invoked from network); 28 Jul 2004 03:06:23 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 28 Jul 2004 03:06:23 -0000 Received: (qmail 7596 invoked by alias); 28 Jul 2004 03:05:06 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20209 Received: (qmail 7585 invoked from network); 28 Jul 2004 03:05:05 -0000 Received: from unknown (HELO a.mx.sunsite.dk) (130.225.247.88) by 130.225.247.90 with SMTP; 28 Jul 2004 03:05:05 -0000 Received: (qmail 49505 invoked from network); 27 Jul 2004 21:36:16 -0000 Received: from mail36.messagelabs.com (193.109.254.211) by a.mx.sunsite.dk with SMTP; 27 Jul 2004 21:36:12 -0000 X-VirusChecked: Checked X-Env-Sender: okiddle@yahoo.co.uk X-Msg-Ref: server-19.tower-36.messagelabs.com!1090861771!7976559 X-StarScan-Version: 5.2.10; banners=-,-,- X-Originating-IP: [158.234.9.163] Received: (qmail 23224 invoked from network); 26 Jul 2004 17:09:31 -0000 Received: from iris.logica.co.uk (158.234.9.163) by server-19.tower-36.messagelabs.com with SMTP; 26 Jul 2004 17:09:31 -0000 Received: from trentino.logica.co.uk ([158.234.142.61]) by iris.logica.co.uk (8.12.3/8.12.3/Debian -4) with ESMTP id i6QH9VUI029882; Mon, 26 Jul 2004 18:09:31 +0100 Received: from trentino.logica.co.uk (localhost [127.0.0.1]) by trentino.logica.co.uk (Postfix) with ESMTP id 2CF8A7AB6CCA; Mon, 26 Jul 2004 15:59:20 +0200 (CEST) X-VirusChecked: Checked X-StarScan-Version: 5.0.7; banners=.,-,- In-reply-to: From: Oliver Kiddle References: To: chris s Cc: zsh-workers@sunsite.dk Subject: Re: starting completions with =,<,> Date: Mon, 26 Jul 2004 15:59:20 +0200 Message-ID: <7532.1090850360@trentino.logica.co.uk> X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=-1.1 required=6.0 tests=BAYES_01,DATE_IN_PAST_03_06 autolearn=no version=2.63 X-Spam-Hits: -1.1 chris s wrote: > Ok, I was looking more into this, and it turns out the bash completion is > able to handle =, >=,<=. The bash person did this: That sort of approach wouldn't work in zsh. It does a lot of the work for you when it comes to quoting. In the previous e-mail: > emerge -p =zsh-4.2.0-r1 > emerge -p '>zsh-4.2.0' > emerge -p ' emerge -p '>=zsh-4.2.0' > emerge -p zsh > > are all valid commands. I saw in the manpage that _values does not > support the equal sign. Unfortunately, that's exactly what I need. I looked at your script and it is using _arguments. It's a bit messy to handle the quoting. Try the following as a starting point: _arguments -C \ '--pretend[pretend an emerge]' \ '--exact[specify exact version]' \ '*: :->args' case $state in args) if compset -P '(\\|)[<=>]*'; then compadd zsh-4.2.0-r1 etc etc else _values -S '' 'version prefix' \ '=[specify exact version]:' \ '<[specify maximum version]:' \ '>[specify too old version]:' \ '>=[specify minimum version]:' compadd zsh etc etc fi ;; esac You'll need to put a proper tags loop around the bit with _values and the other compadd. I'm not really using _values in the way it was intended but this does work. Note that you probably shouldn't be using the :*: stuff in _arguments. Look inside the opt_args associative array from inside the args state instead. You don't need to do anything with the -equals- context. You just need to either write: emerge -p \=zsh-4.2.0-r1 (or emerge -p '=zsh-4.2.0-r1') or use unsetopt equals in your setup. This applies regardless of any completion function setup. This is what the emerge man page means when it says "in many shells you will need to escape characters such as '<' and '='" Oliver