From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29218 invoked from network); 1 Oct 2008 09:39:57 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 1 Oct 2008 09:39:57 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 52497 invoked from network); 1 Oct 2008 09:39:35 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 1 Oct 2008 09:39:35 -0000 Received: (qmail 28993 invoked by alias); 1 Oct 2008 09:39:16 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25790 Received: (qmail 28972 invoked from network); 1 Oct 2008 09:39:12 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 1 Oct 2008 09:39:12 -0000 Received: from esacom89-int.esoc.esa.int (esacom89-ext.esoc.esa.int [131.176.86.4]) by bifrost.dotsrc.org (Postfix) with ESMTP id BF0F38030847 for ; Wed, 1 Oct 2008 11:39:07 +0200 (CEST) Received: from esacom53.esoc.esa.int (131-176-86-254.esoc.esa.int [131.176.86.254]) by esacom89-int.esoc.esa.int (8.13.3/8.13.3/ESA-External-v4.0) with ESMTP id m919d1Xc026586; Wed, 1 Oct 2008 09:39:01 GMT Received: from dcle12.dev.esoc.esa.int (dcle12.dev.esoc.esa.int [131.176.58.71]) by esacom53.esoc.esa.int (8.12.10/8.12.10/ESA-Internal-v3.2) with ESMTP id m919cq23006232; Wed, 1 Oct 2008 09:38:52 GMT Received: from dcle12.dev.esoc.esa.int (localhost [127.0.0.1]) by dcle12.dev.esoc.esa.int (8.13.8+Sun/8.13.8) with ESMTP id m919cq95012706; Wed, 1 Oct 2008 09:38:52 GMT Received: from dcle12 (okiddle@localhost) by dcle12.dev.esoc.esa.int (8.13.8+Sun/8.13.8/Submit) with ESMTP id m919cqJ2012703; Wed, 1 Oct 2008 11:38:52 +0200 (CEST) X-Authentication-Warning: dcle12.dev.esoc.esa.int: okiddle owned process doing -bs cc: "Zsh Workers" In-reply-to: From: Oliver Kiddle References: To: "Nikolai Weibull" Subject: Re: rm(1) completion definition Date: Wed, 01 Oct 2008 11:38:52 +0200 Message-ID: <12702.1222853932@dcle12> X-Virus-Scanned: ClamAV 0.92.1/8365/Wed Oct 1 11:03:36 2008 on bifrost X-Virus-Status: Clean Nikolai Weibull wrote: > 1. It seems that my trick to disable --force and --recursive on > non-GNU systems doesn't work. Does the specifications have to match This is better done as: args=( ${args:#*--(force|recursive)\[*} ) The ! syntax is intended for a different purpose: where you have an option that may appear earlier on the command-line and you don't want to complete it but _arguments needs to know what it's exclusion lists and arguments are. > 2. I'm not sure if the zstyle thing is correct, but it's definitely > what you want it to do. Is there a better way to achieve the same > effect? The problem with the zstyle stuff is that you've used single quotes so $curcontext is not expanded. Personally, I think it is fundamentally wrong to ever define zstyles in completion functions. They are meant for user-customisation and can sometimes get in the way of customisations. The very specific context for them can make them hard to override. At some point in the past, there was a problem with ignore-line that meant that if you tried to do something like: rm foo dir/foo It wouldn't complete foo in the subdirectory. I can't reproduce this now so perhaps it was a bit more subtle or perhaps it got fixed. The right way to do this would be to work out exactly what can't be completed and build up a suitable glob pattern to pass to _files with -g. One other point: I really hope that running rm --version can't possibly actually result in a file or files being removed on some system. I'm a bit uneasy about it. Perhaps you should try using rm --help instead because there's no `r' in help. Oliver