Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Re: problem with _arguments



Adam Spiers wrote:

> I'm trying to write a very simple completion for a function, with the
> following requirements:
> 
>  - the function has one optional option '-l' with no parameter
>  - the first parameter can't be completed
>  - subsequent parameters are files
> 
> AFAICS from the docs, the completion function should be something
> like:
> 
> _foo () {
>   _arguments \
>     '-l[message for option]' \
>     ':description for first param: ' \
>     '*:description for files:_files'
> }
> 
> But with the latest CVS:
> 
> $ foo -<TAB>
> $ foo -
> ---- description for first param
> 
> What am I doing wrong, or is it a bug?

Au, verflucht. _main_complete forced listing when a _message was added 
and there were less than two matches. Unfortunately, it forced
message-only listing, so the option just wasn't shown.

The patch will make it show the message and the option, which is what
should have been done before. If this is good or if it should only
complete the option is a different question. Hm. Hm?

Bye
 Sven

Index: Completion/Core/_main_complete
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_main_complete,v
retrieving revision 1.37
diff -u -r1.37 _main_complete
--- Completion/Core/_main_complete	2000/07/13 11:04:00	1.37
+++ Completion/Core/_main_complete	2000/07/27 07:16:39
@@ -266,7 +266,7 @@
   fi
 elif [[ nm -le 1 && -n "$_comp_mesg" ]]; then
   compstate[insert]=''
-  compstate[list]='list force messages'
+  compstate[list]='list force'
 elif [[ nm -eq 0 && -z "$_comp_mesg" &&
         $#_lastdescr -ne 0 && $compstate[old_list] != keep ]] &&
      zstyle -s ":completion:${curcontext}:warnings" format format; then

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author