From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23670 invoked by alias); 6 Sep 2013 20:16:46 -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: 31707 Received: (qmail 25887 invoked from network); 6 Sep 2013 20:16:41 -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.215.175 is neither permitted nor denied by SPF record at ntlworld.com) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=Hc/H+RA7AyBu33nIZ1HEHUMBqHCLQG1JOHgFfaqZSkI=; b=V0ZOxRWCL7YTu5PKm+Ao5tHlGpd3nJiQii4+dptyR4UAF1affv3suiQjpa6/rrstQm 4Q3NYsRkvIrEiQrQ7xs3u9hCjk3M0fI32nntGz6eDU82ex90T4QLdUDvxE0RZHupc33r M6ikhObhkoxy2x3JswVUp5T8T0WO11eCFZhjyg/ek+tCiimwjfTGs993LryoPvkFCLBW X8BGYzUc+HjaOK5nJpcPCr1rtFVfuy0X+fez7PnKQN22VFuQjo4nUd3yAOJewg6gCFmv 32rMtT/PKoRN3gUSZPBdWZqrkBSGnb+592cJQiiH2sSNaRc1Ye0+34ob7lZCbxc6VwzR hSsg== X-Gm-Message-State: ALoCoQm22SwBUS91mPTdwtbxaJL2xEvq5RY0hm4eWHoFh8XJ2ExPj47XdrB8opqc8gme8eef16um X-Received: by 10.14.219.198 with SMTP id m46mr6623885eep.41.1378498181798; Fri, 06 Sep 2013 13:09:41 -0700 (PDT) X-ProxyUser-IP: 86.6.30.159 Date: Fri, 6 Sep 2013 21:09:38 +0100 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: Directory completion acts as if CHASE_LINKS is set Message-ID: <20130906210938.30f56d8e@pws-pc.ntlworld.com> In-Reply-To: <130905083139.ZM29859@torch.brasslantern.com> References: <130905083139.ZM29859@torch.brasslantern.com> 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 On Thu, 05 Sep 2013 08:31:39 -0700 Bart Schaefer wrote: > diff --git a/Completion/Zsh/Command/_cd b/Completion/Zsh/Command/_cd > index 476947f..9c82a2f 100644 > --- a/Completion/Zsh/Command/_cd > +++ b/Completion/Zsh/Command/_cd > @@ -51,6 +51,14 @@ else > _directory_stack && ret=0 > fi > > + if [[ $PREFIX = (|*/)..(|/*) ]]; then > + local tmpprefix > + # Use cd in a subshell to properly [not] resolve symlinks > + tmpprefix=$(cd $PREFIX >&/dev/null && print $PWD) || > + tmpprefix=$(cd $PREFIX:h >&/dev/null && print $PWD/$PREFIX:t) > + [[ -n $tmpprefix ]] && PREFIX=$tmpprefix > + fi > + > if [[ $PREFIX != (\~|/|./|../)* ]]; then > local tmpcdpath alt You're probably going to be better off using ${PREFIX:a} rather than cd. I also wonder if it would be better only to look at previous directory components, i.e. always take the PREFIX up to the last "/" (and require that there be one) rather than have two cases. I doubt there's much you can do better if you're completing in the middle of the word. If COMPLETEINWORD is not set, so you're sensitive to $SUFFIX, you might use $PREFIX$SUFFIX, but apart from that $PREFIX looks like the only interesting bit for path resolution. This is rather specialised. -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/