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

PATCH: Re: Completion/User functions again



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.

>  - _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 :-)

This is why I changed _hosts to generate a hosts array from /etc/hosts
if $hosts is unset. This may not work perfectly on all systems but it's
better than just assuming $hosts is set and can always be improved
later. Following is a patch so _rlogin and _x_options use _hosts - I
must have forgotten to do this before. 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.

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

chown and chgrp will work on the vast majority of systems. They could
certainly be improved to generate a more reliable list of groups though.
Maybe stty can be improved by parsing the output of stty -a.

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

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.

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.

Oliver Kiddle

*** Completion/User/_rlogin.old	Wed Jul 14 12:36:32 1999
--- Completion/User/_rlogin	Wed Jul 14 12:37:42 1999
***************
*** 1,7 ****
  #compdef rlogin rsh ssh
  
  if [[ CURRENT -eq 2 ]]; then
!   compgen -k hosts
  elif [[ CURRENT -eq 3 ]]; then
    compadd - -l
  else
--- 1,7 ----
  #compdef rlogin rsh ssh
  
  if [[ CURRENT -eq 2 ]]; then
!   _hosts
  elif [[ CURRENT -eq 3 ]]; then
    compadd - -l
  else
*** Completion/User/_x_options.old	Wed Jul 14 12:36:39 1999
--- Completion/User/_x_options	Wed Jul 14 12:37:42 1999
***************
*** 3,9 ****
  # A simple pattern completion, just as an example.
  
  if [ "$words[CURRENT-1]" = "-display" ]; then
!   compgen -k hosts -S':0'
  else
!   compadd -J options - -display -name -xrm
  fi
--- 3,9 ----
  # A simple pattern completion, just as an example.
  
  if [ "$words[CURRENT-1]" = "-display" ]; then
!   ISUFFIX=':0' _hosts
  else
!   compadd -P- -J options - display name xrm
  fi



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