From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1237 invoked from network); 1 Sep 2004 09:16:52 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 1 Sep 2004 09:16:52 -0000 Received: (qmail 67571 invoked from network); 1 Sep 2004 09:16:46 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 1 Sep 2004 09:16:46 -0000 Received: (qmail 23983 invoked by alias); 1 Sep 2004 09:16:44 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20294 Received: (qmail 23969 invoked from network); 1 Sep 2004 09:16:44 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 1 Sep 2004 09:16:44 -0000 Received: (qmail 67293 invoked from network); 1 Sep 2004 09:16:44 -0000 Received: from moonbase.zanshin.com (64.84.47.139) by a.mx.sunsite.dk with SMTP; 1 Sep 2004 09:16:41 -0000 Received: from toltec.zanshin.com (toltec.zanshin.com [64.84.47.166]) by moonbase.zanshin.com (8.13.1/8.13.1) with ESMTP id i819Gbit014343; Wed, 1 Sep 2004 02:16:37 -0700 Date: Wed, 1 Sep 2004 02:16:37 -0700 (PDT) From: Bart Schaefer Reply-To: zsh-workers@sunsite.dk To: Vincent Lefevre cc: zsh-workers@sunsite.dk Subject: Re: bad cd completion for ../ (with CHASE_DOTS unset) In-Reply-To: <20040830130320.GB19488@greux.loria.fr> Message-ID: References: <20040830130320.GB19488@greux.loria.fr> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=-0.0 required=6.0 tests=BAYES_44 autolearn=no version=2.63 X-Spam-Hits: -0.0 I'm having a serious case of deja-vu over this ... I'm sure I explained this before, and not that long ago, but I can't find the message anywhere. On Mon, 30 Aug 2004, Vincent Lefevre wrote: > Here, CHASE_DOTS isn't set, and my /home/lefevre/Mail directory contains > [a] symbolic link [...] if I try to do a completion with "cd ../[TAB]", > zsh gives the completions corresponding to the subdirectories of > /users/spaces/lefevre/Mail instead of the subdirectories of > /home/lefevre/Mail, though CHASE_DOTS isn't set. I think this is a bug. The trouble is that completion uses globbing to find the possible matching files, and globbing always behaves the way "cd" does with CHASE_LINKS set. You might think that the fix is as easy as deleting "parent/.." substrings and replacing a leading "../" with "$PWD:h/", but the way the completion code is structured makes that a tricky proposition ... I don't think there is any variable whose value can be changed in _cd that remains visible down in _path_files when it starts decomposing the path at slashes and examining each directory ... and even if there is, doing so would probably generate some strange completions. That means the only "fix" is putting a fairly ugly special-case into _path_files that applies only to _cd, without breaking every other path completion in the world. Sven W. is incommunicado and no one else has been brave enough to plunge into the jungle with a machete. (I've always thought CHASE_LINKS ought to be the one and only behavior.) A possible workaround is to insert another function into your completer style, which acts as an expander to do the above-mentioned replacements on the current word. Thus you'd have this sort of behavior: zsh% cd ~/Mail/arc zsh% cd ../ zsh% cd ~/Mail/ That is, you'd have to press TAB once to get the expansion before you can start completing. > Please Cc to me (the Mail-Followup-To should be set correctly). Chortle. Quite a, shall we say, discussion about M-F-T is in progress on one of the IETF lists the last couple of days.