From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1855 invoked by alias); 3 Jun 2011 06:59:53 -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: 29443 Received: (qmail 27354 invoked from network); 3 Jun 2011 06:59:43 -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,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <110602235938.ZM16470@torch.brasslantern.com> Date: Thu, 02 Jun 2011 23:59:36 -0700 In-reply-to: <225f0be.6cc0.13053a1119b.Coremail.hanpingtian@163.com> Comments: In reply to hanpingtian "[PATCH] make OLDPWD influence 'cd -'" (Jun 3, 11:52am) References: <225f0be.6cc0.13053a1119b.Coremail.hanpingtian@163.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: [PATCH] make OLDPWD influence 'cd -' MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Jun 3, 11:52am, hanpingtian wrote: } Subject: [PATCH] make OLDPWD influence 'cd -' } } This patch will let zsh check OLDPWD before run 'cd -', so let OLDPWD } influence it: } [hpt@hpt]~% echo $OLDPWD } /home/hpt } [hpt@hpt]~% vared OLDPWD } /tmp } [hpt@hpt]~% cd - } /tmp } [hpt@hpt]/tmp% pwd } /tmp Hmm. Aside from the fact that this makes OLDPWD sort of half a special variable -- it at least moves it from the "set by the shell" category into "used by the shell" -- I think putting this behavior into the "cd" command may not be the best place for it. In particular, it means that "cd -" and "cd ~-" become different things, where currently they're all equivalent. Further, it affects "pushd -" so that it no longer refers to the top of the directory stack. --