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

Re: PATCH: Re: Completion/User functions again



Oliver Kiddle wrote:

> Andrej Borsenkow wrote:
> > 
> >  - _tar and _find are hopelessly GNUish. You cannot expect, that users will
> > study every function to find out if it is applicable to there system. They will
> > simply install it and wonder why it does not work. Of course, gzip, configure
> > etc are GNU as well - but they do not conflict with system standard commands.
> 
> This is why I suggested a while ago that things such as tar and find are
> moved to a 'Gnu' directory and other directories such as Aix, Irix etc
> can contain completions specific to
> those systems.

I've been thinking about this for a long time, too. The problems are
that we would have to fill those directories (so that they don't look
silly) and with such directories users would expect to need only to
copy the contents of one such directory (or link User to it), so they
would have to be (almost) complete. That's a lot of work and who'll do 
that, I wonder.

While we are at it: we still don't have completion functions for some
commands for which we have compctl examples, e.g. cvs and rpm. I don't 
use either of these often enough to be able to write good functions
for them -- any volunteers for that?

> The patch to _x_options also
> causes it to only complete options on words starting with a '-'. I
> prefer to complete options this way as it keeps the number of matches
> down.

I never expected _x_options to survive this long... ;-)

> Maybe we should put a note in one of the readmes to make it clear that
> the functions may not work on all systems, maybe detailing which might
> have issues. I find many of the functions enormously useful and it would
> be a pity for them not to be used.

Maybe, yes.

> One thing which I just noticed which I don't think is right:
> rlogin <tab>
> zsh: do you wish to see all 114 possibilities? n
> The no returns to 'rlogin ' on the command-line. now, if I press tab
> again, menu completion
> starts. I think it should ignore the original tab if the question was
> answered with no.

Hm. 1) It has always been like that (or should have been). 2) Dunno,
you can always use ^D, but I don't have a real opinion about this --
anyone else wanting to comment?


Maybe we should add some kind of programming style guide some day,
containing things like `make functions that can be used as helper
functions do something useful with their arguments if possible' and
`do not use compgen if you're only after the -k or -s options'
(compadd is faster and -- I think -- cleaner for this).

Bye
 Sven

diff -u -r oc/User/_hosts Completion/User/_hosts
--- oc/User/_hosts	Tue Jul 13 10:58:41 1999
+++ Completion/User/_hosts	Wed Jul 14 14:32:29 1999
@@ -2,4 +2,4 @@
 
 : ${(A)hosts:=${(s: :)${(ps:\t:)${${(f)"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}}
 
-compgen -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' -k hosts
+compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" - "$hosts[@]"
diff -u -r oc/User/_x_options Completion/User/_x_options
--- oc/User/_x_options	Wed Jul 14 14:33:41 1999
+++ Completion/User/_x_options	Wed Jul 14 14:42:29 1999
@@ -3,7 +3,8 @@
 # A simple pattern completion, just as an example.
 
 if [ "$words[CURRENT-1]" = "-display" ]; then
-  ISUFFIX=':0' _hosts
+  _compskip=''
+  _hosts -S :0
 else
   compadd -P- -J options - display name xrm
 fi

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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