From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18594 invoked by alias); 28 Apr 2013 18:13:05 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 31348 Received: (qmail 17047 invoked from network); 28 Apr 2013 18:12:52 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 Received-SPF: neutral (ns1.primenet.com.au: 209.85.212.179 is neither permitted nor denied by SPF record at ntlworld.com) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-proxyuser-ip:date:from:to:subject:message-id :in-reply-to:references:x-mailer:mime-version:content-type :content-transfer-encoding:x-gm-message-state; bh=jVIGJtFUJKkRYb2hwTkkR80uDz4yUOLu0QXoVoQARvg=; b=XxDkoDFxnPKPTqw341rWe2hqK6TT6m5+kFFRBpAIlVXlQaBZ9s9IplcpRz7r7CUDOv yXhMFtBmeBfGnFdOrEZIIu55tezbL7qMXpKMx/vOE4CdpI7T96tO2r9iPGdS/pxy5guj 97XM1GHUydzflX01DVtj0y2bdkulIZ5Ea0P3QOn+zx7k9ArhvqL9y346N0HgO2OsTOc7 qO+FcVQfXuD0gaNAJuHvQzs0dYKcSqXHePXSOWDkoLFUEwA4pYbczl/Ydr4Eew9q4GEi KtdlDQmZ+83piEdFyrmoTHXLaPPtcj7UhpKt0RIiFqTxlAgNdZSQOO9iKYdHvk7W53ht c1qw== X-Received: by 10.194.235.169 with SMTP id un9mr19592036wjc.1.1367172763964; Sun, 28 Apr 2013 11:12:43 -0700 (PDT) X-ProxyUser-IP: 86.6.30.159 Date: Sun, 28 Apr 2013 19:12:40 +0100 From: Peter Stephenson To: Felipe Contreras , zsh-workers@zsh.org Subject: Re: No way to properly complete specific set of files Message-ID: <20130428191240.34181099@pws-pc.ntlworld.com> In-Reply-To: References: X-Mailer: Claws Mail 3.8.0 (GTK+ 2.24.7; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQmmLJ7PEyrLOD8fCIfOaZw119xWHGKNFQKn82sKGyGMvbo9rKY9748WBPaHgYB6zX/Mh8pR On Sat, 27 Apr 2013 05:12:27 -0500 Felipe Contreras wrote: > I have an array, let's say: > > files=('Documents' 'Downloads' 'Downloads/test' 'Videos') > > And I want to complete those files, with all the niceties that _file has. >... > Am I missing something? I don't think you're missing anything in the sense that there's anything really designed for this, no... to follow up on something Bart noted earlier, the completion system is written in such a way that it doesn't provide a lot of support for things that aren't done the way the original author thought of. It would be great to refactor it to be both more general and more maintainable, but alas there are way too few volunteers for that sort of exercise. However, you can trick it to some extent: _path_files -g "(${(j.|.)~files})" relying on an extended_glob pattern to match any of the files. That's not perfect --- in particular if there are metacharacters in the file names they'll confuse it. Further, I think you're going to have trouble with directories; you'd need to decide what the files were within the current directory path, so you can't do stuff like complete Downloads/test directly that way. It's probably possible to work around --- factor out the path that's already been completed --- but a bit fiddly and not gaining a lot over what you're already doing. -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/