zsh-workers
 help / color / mirror / code / Atom feed
* Completion/User functions again
@ 1999-07-14 10:37 Andrej Borsenkow
  1999-07-14 12:09 ` PATCH: " Oliver Kiddle
  0 siblings, 1 reply; 4+ messages in thread
From: Andrej Borsenkow @ 1999-07-14 10:37 UTC (permalink / raw)
  To: ZSH workers mailing list

I'm still feeling uneasy about installing all of these functions. There are
several reasons:

 - _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.

 - _hosts, _rlogin, _x_options are using array hosts. This most probably does
not exist. Again, I do not like installing something that does not work
out-of-the-box by default. This should be done explicitly in hope, that users
understand what's going on :-)

 - _chown, _chgrp, _stty are too system dependent. It is better to not provide
completion at all than provide completion that only partially works. I do not
suggest removing them from distribution - but to not install them by default.

To summarise - I firmly believe, that everything that gets installed must work
"as is" on every system. Anything that works only on some systems or something
that needs additional setup should only be installed explicitly.

/andrej


^ permalink raw reply	[flat|nested] 4+ messages in thread
* Re: PATCH: Re: Completion/User functions again
@ 1999-07-14 12:46 Sven Wischnowsky
  1999-07-14 13:12 ` Tanaka Akira
  0 siblings, 1 reply; 4+ messages in thread
From: Sven Wischnowsky @ 1999-07-14 12:46 UTC (permalink / raw)
  To: zsh-workers


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@informatik.hu-berlin.de


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

end of thread, other threads:[~1999-07-14 13:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-07-14 10:37 Completion/User functions again Andrej Borsenkow
1999-07-14 12:09 ` PATCH: " Oliver Kiddle
1999-07-14 12:46 Sven Wischnowsky
1999-07-14 13:12 ` Tanaka Akira

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).