From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10315 invoked from network); 23 Mar 2000 09:01:15 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 23 Mar 2000 09:01:15 -0000 Received: (qmail 16369 invoked by alias); 23 Mar 2000 09:00:32 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10209 Received: (qmail 16360 invoked from network); 23 Mar 2000 09:00:31 -0000 Date: Thu, 23 Mar 2000 10:00:31 +0100 (MET) Message-Id: <200003230900.KAA23127@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: "Andrej Borsenkow"'s message of Thu, 23 Mar 2000 11:55:04 +0300 Subject: RE: PATCH: tag aliases Andrej Borsenkow wrote: > > So, from a user's point of view the change is rather small, but the > > fact that multiple tag aliases have to be tried everywhere is > > responsible for most of the patch. I did this by adding two new > > functions `_try' and `_loop' > > Am I blind or are both really missing in your patch? Oh damn... I hate it when this happens. I made the patch at home, applied it here and used my diffing-function to get my standard patch format -- and forgot to touch the files in the backup before that. Sorry! Here are the two in their current state. Bye Sven diff -ru ../z.old/Completion/Core/_loop Completion/Core/_loop --- ../z.old/Completion/Core/_loop Thu Mar 23 09:58:07 2000 +++ Completion/Core/_loop Thu Mar 23 09:07:11 2000 @@ -0,0 +1,44 @@ +#autoload + +local gopt=-J len tmp pre suf tloop ret=1 descr + +if [[ "$1" = -t ]]; then + tloop=yes + shift +fi +if [[ "$1" = -([12]|)[VJ] ]]; then + gopt="$1" + shift +fi + +tmp=${argv[(ib:4:)-]} +len=$# +if [[ tmp -lt len ]]; then + pre=$(( tmp-1 )) + suf=$tmp +elif [[ tmp -eq $# ]]; then + pre=-2 + suf=$(( len+1 )) +else + pre=4 + suf=5 +fi + +while [[ -z "$tloop" ]] || comptags -N; do + while comptags -A "$1" curtag; do + if [[ "$curtag" = *:* ]]; then + zformat -f descr "${curtag#*:}" "d:$3" + _description "$gopt" "${curtag%:*}" "$2" "$descr" + curtag="${curtag%:*}" + + "$4" "${(P@)2}" "${(@)argv[5,-1]}" + else + _description "$gopt" "$curtag" "$2" "$3" + + "${(@)argv[4,pre]}" "${(P@)2}" "${(@)argv[suf,-1]}" && ret=0 + fi + done + [[ -z "$tloop" || ret -eq 0 ]] && break +done + +return ret diff -ru ../z.old/Completion/Core/_try Completion/Core/_try --- ../z.old/Completion/Core/_try Thu Mar 23 09:58:07 2000 +++ Completion/Core/_try Wed Mar 22 10:18:29 2000 @@ -0,0 +1,24 @@ +#autoload + +local gopt=-J descr + +if [[ "$1" = -([12]|)[VJ] ]]; then + gopt="$1" + shift +fi + +if comptags -A "$1" curtag; then + if [[ "$curtag" = *:* ]]; then + zformat -f descr "${curtag#*:}" "d:$3" + _description "$gopt" "${curtag%:*}" "$2" "$descr" + curtag="${curtag%:*}" + eval "${2}=( \${(P)2} \$argv[4,-1] )" + else + _description "$gopt" "$curtag" "$2" "$3" + eval "${2}=( \$argv[4,-1] \${(P)2} )" + fi + + return 0 +fi + +return 1 -- Sven Wischnowsky wischnow@informatik.hu-berlin.de