From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20794 invoked by alias); 10 Sep 2013 14:26:41 -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: 31714 Received: (qmail 1407 invoked from network); 10 Sep 2013 14:26:34 -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=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <130910072613.ZM9580@torch.brasslantern.com> Date: Tue, 10 Sep 2013 07:26:13 -0700 In-reply-to: <130908142628.ZM27141@torch.brasslantern.com> Comments: In reply to Bart Schaefer "Re: Directory completion acts as if CHASE_LINKS is set" (Sep 8, 2:26pm) References: <130905083139.ZM29859@torch.brasslantern.com> <20130906210938.30f56d8e@pws-pc.ntlworld.com> <130906220300.ZM31578@torch.brasslantern.com> <20130908185136.711ad4ca@pws-pc.ntlworld.com> <130908142628.ZM27141@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: Directory completion acts as if CHASE_LINKS is set MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Sep 8, 2:26pm, Bart Schaefer wrote: } } Ah, I see. Yes, that does work, and furthermore gave me the clue that I } needed to get the commmand line handling right. Discovered I needed a reference to $tmpWpath in one more place. Here is the final diff ... unless we find out I messed up about IPREFIX. diff --git a/Completion/Zsh/Command/_cd b/Completion/Zsh/Command/_cd index 476947f..a5d328f 100644 --- a/Completion/Zsh/Command/_cd +++ b/Completion/Zsh/Command/_cd @@ -51,6 +51,18 @@ else _directory_stack && ret=0 fi + local -a tmpWpath + if [[ $PREFIX = (|*/)../* ]]; then + local tmpprefix + # Use cd in a subshell to properly [not] resolve symlinks + tmpprefix=$(cd ${PREFIX%/*} >&/dev/null && print $PWD) + if [[ -n $tmpprefix ]]; then + tmpWpath=(-W $tmpprefix) + IPREFIX=${IPREFIX}${PREFIX%/*}/ + PREFIX=${PREFIX##*/} + fi + fi + if [[ $PREFIX != (\~|/|./|../)* ]]; then local tmpcdpath alt @@ -88,7 +100,7 @@ else # already handled by _command_names (see _autocd) [[ CURRENT -ne 1 || ( -z "$path[(r).]" && $PREFIX != */* ) ]] && - alt=( "${cdpath+local-}directories:${cdpath+local }directory:_path_files -/" "$alt[@]" ) + alt=( "${cdpath+local-}directories:${cdpath+local }directory:_path_files $tmpWpath -/" "$alt[@]" ) if [[ CURRENT -eq argstart && noopts -eq 0 && $PREFIX = -* ]] && zstyle -t ":completion:${curcontext}:options" complete-options; then @@ -100,7 +112,7 @@ else return ret fi [[ CURRENT -ne 1 ]] && _wanted directories expl directory \ - _path_files -/ && ret=0 + _path_files $tmpWpath -/ && ret=0 return ret fi