zsh-workers
 help / color / mirror / code / Atom feed
* RE: Passsing descriptions down in completion functions
@ 2003-01-09 16:26 Borzenkov Andrey
  2003-01-09 17:09 ` Oliver Kiddle
  0 siblings, 1 reply; 8+ messages in thread
From: Borzenkov Andrey @ 2003-01-09 16:26 UTC (permalink / raw)
  To: 'zsh-workers@sunsite.dk'

> 
> The general question - should completion functions ever accept (be used
> with) other options than compadd? If not the above is perfectly valid and
> probably more simple that modifying every single function. If yes, here is
> the list of functions that use _wanted without '-'.
> 

Well, I started to look into these functions and immediately hit some
problems:

AIX/Type/_object_classes:

_wanted objectclasses expl 'object class' \
   _files -W ${ODMDIR:-/etc/objrepos} -g '^*.vc'

Here is just no place where I could stuff the magic "-". Granted, this one
does not pass arguments it receives but in general I do not see why it
should not do it.

Base/Utility/_sub_commands

if [[ CURRENT -eq 2 ]]; then
  _wanted commands expl command compadd "$@"
else
  _message 'no more arguments'
fi

almost the same problem. In this case arguments contain both description and
matches so I have no way to stuff "-" in between.

-andrey


^ permalink raw reply	[flat|nested] 8+ messages in thread
* Passsing descriptions down in completion functions
@ 2003-01-09 13:17 Borzenkov Andrey
       [not found] ` <32149.1042120127@finches.logica.co.uk>
  0 siblings, 1 reply; 8+ messages in thread
From: Borzenkov Andrey @ 2003-01-09 13:17 UTC (permalink / raw)
  To: 'zsh-workers@sunsite.dk'

Either I do not understand something basic or it does not work (and probably
has never working really).

Simple example.

bor@itsrm2% functions _foo
_foo () {
        _arguments -s "-p[some option]:argument for this option:_hosts"
}
bor@itsrm2% compdef _foo foo
bor@itsrm2% foo -p TAB
bor@itsrm2% foo -p D248H032
Completing host
           ^^^^ should it not be "argument for that option"?
D248H032               GH4090Y0               anyhost
...

It is clear what happens:

+_arguments:340> _hosts -J option-p-1 -X '%BCompleting argument for this
option%b'

this sounds good, but later on ...

+_all_labels:37> compadd -J hosts -X '%BCompleting host%b' -M
'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' -J option-p-1 -X '%BCompleting argument
for this option%b' -a hosts

Oops, description is now lost.

Quoting documentation:

                                              If the ACTION starts
     with a space, this list of words will be invoked unchanged,
     otherwise it will be invoked with some extra strings placed after
     the first word which can be given as arguments to the compadd
     builtin command and which make sure that the MESSAGE given in the
     description will be shown above the matches.

So, is it a bug or not?

-andrej


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2003-01-14 15:41 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-09 16:26 Passsing descriptions down in completion functions Borzenkov Andrey
2003-01-09 17:09 ` Oliver Kiddle
2003-01-10  8:10   ` Borzenkov Andrey
2003-01-14 15:43     ` Oliver Kiddle
  -- strict thread matches above, loose matches on Subject: below --
2003-01-09 13:17 Borzenkov Andrey
     [not found] ` <32149.1042120127@finches.logica.co.uk>
2003-01-09 14:04   ` Oliver Kiddle
2003-01-09 15:09   ` Borzenkov Andrey
2003-01-09 16:11     ` Oliver Kiddle

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).