Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: command completion taking ages
- X-seq: zsh-workers 10146
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: command completion taking ages
- Date: Wed, 15 Mar 2000 10:48:42 +0100 (MET)
- In-reply-to: "Bart Schaefer"'s message of Tue, 14 Mar 2000 18:32:32 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
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@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author