Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: 3.1.5-pws-8: using pattern completions
- X-seq: zsh-workers 5426
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: PATCH: 3.1.5-pws-8: using pattern completions
- Date: Fri, 19 Feb 1999 12:12:33 +0100 (MET)
- In-reply-to: Peter Stephenson's message of Fri, 19 Feb 1999 10:58:16 +0100
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Peter Stephenson wrote:
> Unless I'm missing a patch or two, pattern completions aren't handled
> properly. They work rather differently, so it's necessary to pass extra
> arguments to callcomplete. Possibly these could be passed anyway, saving
> an array look-up in most cases.
There are two more problems: when dumpin patcomps we need to make sure
the elements are not split (they contain at least one space) and the
pattern-function files should not quote the patterns.
> Now, can anyone tell me how to avoid getting a default completion list for
> the pattern completions as well? This is rather crucial since I'm trying
> to get all zf* files to use zftp completion, and I don't want a side dish
> of local filenames with every order.
It's in the `|| return 1'. If a pattern function returns non-zero, the
other patterns and the completion for the command are not tried.
A few open questions:
- The return non-zero convention is intended as a replacement for
`compctl -t'. I didn't document it because I'm not sure if this is
the right way to do it.
- Due to getting the patterns automatically from the files they are
not sorted. This may be an argument in favor of the simplified
processing I used in the `Comp' example directory.
- We probably should also completely remove the completion-array-handling.
This would make the code much cleaner, would allow us to get rid of
the callcomplete-trampoline, and would allow us to call dump anytime.
(I'd like to clean up the whole example code, anyway: use only one
leading underscore, but use it for all functions and aliases, add the
`__if' stuff I described yesterday, remove the aliases, etc. Dunno if
I find the time to do this today, though.)
Bye
Sven
diff -u of/Completion/__x_options Functions/Completion/__x_options
--- of/Completion/__x_options Fri Feb 19 12:01:50 1999
+++ Functions/Completion/__x_options Fri Feb 19 11:28:51 1999
@@ -1,4 +1,4 @@
-#pattern-function '*/X11/*'
+#pattern-function */X11/*
# A simple pattern completion, just as an example.
diff -u of/Completion/dump Functions/Completion/dump
--- of/Completion/dump Fri Feb 19 11:19:21 1999
+++ Functions/Completion/dump Fri Feb 19 11:33:28 1999
@@ -33,7 +33,7 @@
if (( $#patcomps )); then
print "\npatcomps=("
- for __d_f in $patcomps; do
+ for __d_f in "$patcomps[@]"; do
print -r - "'${__d_f//\'/'\\''}'"
done
print ")"
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author