zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <opk@u.genie.co.uk>
To: Zsh workers <zsh-workers@sunsite.auc.dk>
Subject: PATCH: minor completion things
Date: Tue, 23 May 2000 19:00:33 +0100	[thread overview]
Message-ID: <392AC741.6857CF71@u.genie.co.uk> (raw)

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


             reply	other threads:[~2000-05-23 18:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-23 18:00 Oliver Kiddle [this message]
2000-05-24  8:09 Sven Wischnowsky
2000-05-24  9:07 ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=392AC741.6857CF71@u.genie.co.uk \
    --to=opk@u.genie.co.uk \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).