From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11193 invoked by alias); 15 Aug 2011 00:57:40 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 16232 Received: (qmail 6090 invoked from network); 15 Aug 2011 00:57:38 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at vinc17.net does not designate permitted sender hosts) Date: Mon, 15 Aug 2011 02:57:34 +0200 From: Vincent Lefevre To: zsh-users@zsh.org Subject: Re: command completion Message-ID: <20110815005734.GM20653@prunille.vinc17.org> Mail-Followup-To: zsh-users@zsh.org References: <20110814205936.GI20653@prunille.vinc17.org> <110814151453.ZM19551@torch.brasslantern.com> <20110814230737.GK20653@prunille.vinc17.org> <110814165650.ZM19855@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <110814165650.ZM19855@torch.brasslantern.com> X-Mailer-Info: http://www.vinc17.net/mutt/ User-Agent: Mutt/1.5.21-6194-vl-r44775 (2011-07-13) On 2011-08-14 16:56:50 -0700, Bart Schaefer wrote: > As I said before, it's really got to do with how _autocd insinuates itself > into the process. > > Autocd makes itself the handler for -command-. It then calls both > _command_names and _cd, each of which takes a spin through _alternative, > so it goes around the _tags loop twice as well. > > If there were only one pass through _alternative, I think you'd get what > you're looking for; but because there are two passes and there are no > *additional* completions for the "command" tag added inside _cd, all > the defaults for _cd get added as well. OK, but this behavior is a bit strange: if I use zstyle ':completion:*:complete:-command-:*' tag-order 'commands' on my example, then I get: % prefix- prefix-cmd1 prefix-dir/ from the "dir" directory. And from the parent directory "temp_dir", prefix[TAB] gives prefix-cmd1 only (i.e. prefix-dir/ has mysteriously disappeared though it is a cd target). > So, unfortunately, I don't believe you can get what you want with > zstyles. You'll have to rewrite _autocd, something like so: > > #compdef -command- > _command_names && return 0 > [[ -o autocd ]] && _cd && return 0 > return 1 This works. However wouldn't it be cleaner if there were a specific tag for autocd? -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)