zsh-workers
 help / color / mirror / code / Atom feed
* Re: PATCH: minor completion things
@ 2000-05-24  8:09 Sven Wischnowsky
  2000-05-24  9:07 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Sven Wischnowsky @ 2000-05-24  8:09 UTC (permalink / raw)
  To: zsh-workers


Oliver Kiddle wrote:

> ...
> 
> Finally, _lsdev was missing a local definition. One aspect of the
> _arguments documentation which I am not entirely clear on is whether I
> need to declare the local curcontext when we are not using a ->state
> thing? If so, a number of the other AIX completions will need it adding.

No, without a `->state' spec no variables have to make local in the
calling function. Why should you need it, _arguments doesn't give
control back to the caller to handle actions in such cases.

> It seems that the vast majority of uses of _arguments use a -C option:
> the context is rarely useful in a state so maybe -C should be the
> default?

-C was added when we were still struggling to learn the ways of the
contexts... yes, maybe we should make it the default, but I'm probably 
getting a bit tired to yet again change lots of functions. Maybe
someone else finds the time? ;-)

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


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

* Re: PATCH: minor completion things
  2000-05-24  8:09 PATCH: minor completion things Sven Wischnowsky
@ 2000-05-24  9:07 ` Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2000-05-24  9:07 UTC (permalink / raw)
  To: zsh-workers

On May 24, 10:09am, Sven Wischnowsky wrote:
} Subject: Re: PATCH: minor completion things
}
} > It seems that the vast majority of uses of _arguments use a -C option:
} > the context is rarely useful in a state so maybe -C should be the
} > default?
} 
} -C was added when we were still struggling to learn the ways of the
} contexts... yes, maybe we should make it the default, but I'm probably 
} getting a bit tired to yet again change lots of functions. Maybe
} someone else finds the time? ;-)

I think it should stay as it is.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


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

* PATCH: minor completion things
@ 2000-05-23 18:00 Oliver Kiddle
  0 siblings, 0 replies; 3+ messages in thread
From: Oliver Kiddle @ 2000-05-23 18:00 UTC (permalink / raw)
  To: Zsh workers

This does a few minor things:

_perl_basepods was checking with which if basedepods existed before
running basepods. I take it that this was a typo. I've also changed it
(and _perl_modules) to use $+commands[...] instead of which ...
>/dev/null for consistency with other completion functions.

Fixed suffix handling in _user_at_hosts and _chown. Is there a reason
why _user_at_hosts isn't used in _mutt? It could also be used in
_netscape. Should we maybe have a separate function for completing
e-mail addresses which uses things like mutt/mush/pine/netscape address
books.

Finally, _lsdev was missing a local definition. One aspect of the
_arguments documentation which I am not entirely clear on is whether I
need to declare the local curcontext when we are not using a ->state
thing? If so, a number of the other AIX completions will need it adding.
It seems that the vast majority of uses of _arguments use a -C option:
the context is rarely useful in a state so maybe -C should be the
default?

Oliver

Index: Completion/AIX/_lsdev
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/AIX/_lsdev,v
retrieving revision 1.2
diff -u -r1.2 _lsdev
--- Completion/AIX/_lsdev	2000/05/05 13:38:46	1.2
+++ Completion/AIX/_lsdev	2000/05/23 17:57:42
@@ -1,6 +1,6 @@
 #compdef lsdev
 
-local state line expl
+local curcontext="${curcontext}" state line expl
 
 _arguments -C \
   '(-P)-C[list info about device in customized devices object class]' \
Index: Completion/User/_chown
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_chown,v
retrieving revision 1.2
diff -u -r1.2 _chown
--- Completion/User/_chown	2000/04/05 11:28:09	1.2
+++ Completion/User/_chown	2000/05/23 17:57:42
@@ -1,14 +1,18 @@
 #compdef chown chgrp
 
+local suf
+
 if [[ CURRENT -eq 2 || CURRENT -eq 3 && $words[CURRENT-1] = -* ]]; then
   if [[ ${words[1]:t} = chgrp ]] || compset -P '*[:.]'; then
     _groups
   else
     if [[ $OSTYPE = (solaris*|hpux*) ]]; then
-      _users -S ':' -q
+      suf=':'
     else
-      _users -S '.' -q
+      suf='.'
     fi
+    compset -S '.*' && unset suf
+    _users -S "$suf" -q
   fi
 else
   _files
Index: Completion/User/_perl_basepods
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_perl_basepods,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 _perl_basepods
--- Completion/User/_perl_basepods	2000/03/23 04:19:30	1.1.1.4
+++ Completion/User/_perl_basepods	2000/05/23 17:57:42
@@ -11,7 +11,7 @@
 if [[ ${+_perl_basepods} -eq 0 ]]; then
   typeset -agU _perl_basepods
 
-  if which basdepods >/dev/null; then
+  if (( ${+commands[basepods]} )); then
     _perl_basepods=( ${$(basepods):t:r} )
   else
     local podpath
Index: Completion/User/_perl_modules
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_perl_modules,v
retrieving revision 1.3
diff -u -r1.3 _perl_modules
--- Completion/User/_perl_modules	2000/04/27 00:05:53	1.3
+++ Completion/User/_perl_modules	2000/05/23 17:57:42
@@ -22,11 +22,11 @@
 
 if [[ ${+_perl_modules} -eq 0 ]]; then
   if zstyle -t ":completion:${curcontext}:modules" try-to-use-pminst \
-     && which pminst >/dev/null; then
+     && (( ${+commands[pminst]} )); then
     _perl_modules=( $(pminst) )
   else
     local inc libdir new_pms
-    if which perl >/dev/null; then
+    if (( ${+commands[perl]} )); then
       inc=( $( perl -e 'print "@INC"' ) )
     else
       # If perl isn't there, one wonders why the user's trying to
Index: Completion/User/_user_at_host
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_user_at_host,v
retrieving revision 1.1.1.7
diff -u -r1.1.1.7 _user_at_host
--- Completion/User/_user_at_host	2000/03/23 04:19:31	1.1.1.7
+++ Completion/User/_user_at_host	2000/05/23 17:57:42
@@ -5,7 +5,7 @@
 # with `-t tag'.
 # A `-' or `--' as the first argument is ignored.
 
-local tag=accounts
+local suf tag=accounts
 
 if [[ "$1" = -t?* ]]; then
   tag="${1[3,-1]}"
@@ -25,6 +25,7 @@
   _wanted -C user-at hosts expl "host for $user" \
       _combination -s '[:@]' "${tag}" users-hosts users="$user" hosts "$@" -
 else
+  compset -S '@*' || suf="@"
   _wanted users expl "user" \
-      _combination -s '[:@]' "${tag}" users-hosts users -S@ -q "$@" -
+      _combination -s '[:@]' "${tag}" users-hosts users -S "$suf" -q "$@" -
 fi


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

end of thread, other threads:[~2000-05-24  9:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-24  8:09 PATCH: minor completion things Sven Wischnowsky
2000-05-24  9:07 ` Bart Schaefer
  -- strict thread matches above, loose matches on Subject: below --
2000-05-23 18:00 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).