From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8058 invoked from network); 15 Mar 2000 09:48:52 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 15 Mar 2000 09:48:52 -0000 Received: (qmail 15288 invoked by alias); 15 Mar 2000 09:48:46 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10146 Received: (qmail 15278 invoked from network); 15 Mar 2000 09:48:45 -0000 Date: Wed, 15 Mar 2000 10:48:42 +0100 (MET) Message-Id: <200003150948.KAA14415@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: "Bart Schaefer"'s message of Tue, 14 Mar 2000 18:32:32 +0000 Subject: Re: command completion taking ages Bart Schaefer wrote: > On Mar 14, 4:27pm, Sven Wischnowsky wrote: > } Subject: Re: command completion taking ages > } > } zstyle ':completion:*:*:-command-:*' tag-order 'maybe()' - > } > } maybe() { [[ -n $PREFIX ]] && comptry "$@" } > > I wondered about that, but it's not a general solution for cases where > there are multiple tags and you DO want to order them when there IS a > non-empty prefix/suffix. Is there some way for the function to say > "I didn't generate any matches, but don't try any more tags even so"? We can easily make it use the return value for this... So, with this patch one can simplify the above to: maybe() { [[ -n $PREFIX ]] } Bye Sven diff -ru ../z.old/Completion/Core/_sort_tags Completion/Core/_sort_tags --- ../z.old/Completion/Core/_sort_tags Wed Mar 15 10:33:12 2000 +++ Completion/Core/_sort_tags Wed Mar 15 10:44:18 2000 @@ -26,3 +26,5 @@ esac comptry "$@" + +return 0 diff -ru ../z.old/Completion/Core/_tags Completion/Core/_tags --- ../z.old/Completion/Core/_tags Wed Mar 15 10:33:12 2000 +++ Completion/Core/_tags Wed Mar 15 10:40:35 2000 @@ -44,7 +44,11 @@ for tag in $order; do case $tag in -) nodef=yes;; - *\(\)) "${${tag%%[ ]#\(\)}##[ ]#}" "$@";; + *\(\)) if ! "${${tag%%[ ]#\(\)}##[ ]#}" "$@"; then + nodef=yes + break + fi + ;; \!*) comptry "${(@)argv:#(${(j:|:)~${=tag[2,-1]}})}";; ?*) comptry ${=tag};; esac diff -ru ../z.old/Doc/Zsh/compsys.yo Doc/Zsh/compsys.yo --- ../z.old/Doc/Zsh/compsys.yo Wed Mar 15 10:32:51 2000 +++ Doc/Zsh/compsys.yo Wed Mar 15 10:44:08 2000 @@ -1435,7 +1435,10 @@ this case the function var(func) will be called which can then define in which order tags are to be used based on additional context information. See the tt(_sort_tags) function below for a description -of how such functions can be implemented. +of how such functions can be implemented. The return value of the +function is used to decide if the following values for the style +should be used. If it is zero, they are used and if it is non-zero, +they are not used. If no style has been defined for a context, the strings tt(arguments values), tt(options), tt(globbed-files), tt(directories) and -- Sven Wischnowsky wischnow@informatik.hu-berlin.de