From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2718 invoked from network); 19 Feb 1999 11:13:55 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 19 Feb 1999 11:13:55 -0000 Received: (qmail 11549 invoked by alias); 19 Feb 1999 11:13:18 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5426 Received: (qmail 11542 invoked from network); 19 Feb 1999 11:13:16 -0000 Date: Fri, 19 Feb 1999 12:12:33 +0100 (MET) Message-Id: <199902191112.MAA10908@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Peter Stephenson's message of Fri, 19 Feb 1999 10:58:16 +0100 Subject: Re: PATCH: 3.1.5-pws-8: using pattern completions 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@informatik.hu-berlin.de