From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3884 invoked from network); 25 Apr 2001 13:26:05 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 25 Apr 2001 13:26:05 -0000 Received: (qmail 16921 invoked by alias); 25 Apr 2001 13:25:58 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 14092 Received: (qmail 16905 invoked from network); 25 Apr 2001 13:25:57 -0000 From: Sven Wischnowsky Date: Wed, 25 Apr 2001 15:25:52 +0200 (MET DST) Message-Id: <200104251325.PAA03945@beta.informatik.hu-berlin.de> To: zsh-workers@sunsite.dk Subject: Re: Another keep-prefix problem In-Reply-To: [ We only just found out that my machine still had the address of that server that died yesterday in it's resolv.conf... that was the reason why I didn't get my mails back -- they weren't sent. Apologies to the folks at sunsite. Ahem. ] Wayne Davison wrote: > ... > > % ls -l /net/machine$path/foo > > This does not expand anything. I think that it will cause less > confusion if the new expander would work like the old one does in > this regard. > > However, I have the same complaint about keep-prefix when using > wildcards: > > % ls -l /net/machine$path/foo* > > I'd like to see $path left unexpanded. In other words, I want keep- > prefix to preserve the prefix no matter where the $ expression is in > the prefix. Please try the patch below and tell me what you think (and everyone else interested in this subject, too, please). It gives me what you want for both cases. I won't commit this before I get positive replies and answers to the question if we then should add another possible value for the keep-prefix style for this new behaviour or if that's not needed (I can't really think of a reason for keeping the old behaviour -- put some people probably like it?). Bye Sven Index: Completion/Base/Completer/_expand =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Base/Completer/_expand,v retrieving revision 1.1 diff -u -r1.1 _expand --- Completion/Base/Completer/_expand 2001/04/02 11:06:35 1.1 +++ Completion/Base/Completer/_expand 2001/04/25 13:20:37 @@ -89,10 +89,16 @@ [[ "$subd" = "$exp"(|\(N\)) ]] && return 1 zstyle -s ":completion:${curcontext}:" keep-prefix tmp || tmp=changed -if [[ "$word" = [\~\$]*/* && "$tmp" = (yes|true|on|1|changed) ]]; then - eval 'epre=( ${(e)~${word%%/*}} )' 2>/dev/null - if [[ -n "$epre" && $#epre -eq 1 ]]; then + +if [[ "$word" = (\~*/*|*\$*/*) && "$tmp" = (yes|true|on|1|changed) ]]; then + if [[ "$word" = *\$* ]]; then + opre="${(M)word##*\$[^/]##/}" + else opre="${word%%/*}" + fi + eval 'epre=( ${(e)~opre} )' 2> /dev/null + + if [[ -n "$epre" && $#epre -eq 1 ]]; then pre="${(q)epre[1]}" [[ "$tmp" != changed || $#exp -gt 1 || "${opre}${exp[1]#${pre}}" != "$word" ]] && exp=( ${opre}${^exp#${pre}} ) -- Sven Wischnowsky wischnow@informatik.hu-berlin.de