From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 623 invoked from network); 26 Apr 2001 17:19:11 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 26 Apr 2001 17:19:11 -0000 Received: (qmail 21152 invoked by alias); 26 Apr 2001 17:19:04 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 14128 Received: (qmail 21133 invoked from network); 26 Apr 2001 17:19:03 -0000 From: "Bart Schaefer" Message-Id: <1010426171819.ZM17731@candle.brasslantern.com> Date: Thu, 26 Apr 2001 17:18:19 +0000 In-Reply-To: Comments: In reply to Wayne Davison "Re: Another keep-prefix problem" (Apr 26, 8:43am) References: X-Mailer: Z-Mail (5.0.0 30July97) To: Subject: Re: Another keep-prefix problem MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii } On Thu, 26 Apr 2001, Oliver Kiddle wrote: } > For _expand I use the glob 1, substitute 1, suffix 1, accept-exact } > false and tag-order all-expansions styles. keep-prefix changed is } > the default so that too. } > } > To test I did: } > c1=/home } > c3=cvs } > Now, } > cd $c1/kiddleo/$c3/ expands both $c1 and $c3 which I don't want. Then as I understand it you don't want `suffix 1' but rather `suffix 0' and `keep-prefix 1'. The confusion may be that "suffix" here does not mean "everything after the rightmost slash". It means "everything after the LEFTMOST slash." suffix This is used by the _expand completer if the word starts with a tilde or parameter expansion. If it is set to `true', the word will only be expanded if it doesn't have a suffix, i.e. if it is ^^^^^^^ something like `~foo' or `$foo', but not if it is `~foo/' or `$foo/bar', unless that suffix itself contains characters eligible ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ for expansion. The default for this style is `true'. Hmm. Looking more closely at the code, this is messed up. It matches up to the rightmost slash if the string begins with `~', but only up to the leftmost slash when it begins with a `$', unless all the parameter references are in `${...}' form, in which case it matches everything from the lefmost `${' to the rightmost `}' (even if the rightmost `}' is part of a brace-expansion rather than a parameter-expansion, I think), as long as there is something after the rightmost `}'. I spent a while (too long) thinking about how possibly to rewrite this, but didn't come up with anything helpful. On Apr 26, 8:43am, Wayne Davison wrote: } } Your example would also fail if you just had the $c3 variable (i.e. } any variable not at the start of the word). I would like the default } setting of "suffix 1" to work like the "expand-or-complete" code's } expander in this regard. Which means, I think, that you would like the default setting of suffix to be false rather than true, and the default setting of keep-prefix to be true rather than "changed". But I'm not entirely sure of that ... -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net