zsh-workers
 help / color / mirror / code / Atom feed
* Re: PATCH: Re: complete (real C) tags
@ 2000-05-31  9:36 Sven Wischnowsky
  2000-05-31 10:07 ` Peter Stephenson
  0 siblings, 1 reply; 11+ messages in thread
From: Sven Wischnowsky @ 2000-05-31  9:36 UTC (permalink / raw)
  To: zsh-workers


I wrote:

> ...
> 
> [The patch] changes the places I found by a `grep compadd' to use -[ak]... in
> 66 files. It also makes the utility functions like _wanted and
> _all_labels use only parameters named __* so that they shouldn't be in 
> the way anymore. Id does not change _arguments and friends to use this 
> convention, but that should seldom be a problem, especially if one
> uses parameters named like_this in the calling function.
> 
> So, should I commit it?

We are really after 3.1.7 now, yes? I'll commit now (slightly updated).

Bye
 Sven


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


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

* Re: PATCH: Re: complete (real C) tags
  2000-05-31  9:36 PATCH: Re: complete (real C) tags Sven Wischnowsky
@ 2000-05-31 10:07 ` Peter Stephenson
  0 siblings, 0 replies; 11+ messages in thread
From: Peter Stephenson @ 2000-05-31 10:07 UTC (permalink / raw)
  To: Zsh hackers list

> We are really after 3.1.7 now, yes? I'll commit now (slightly updated).

Yes, if we ever find out enough to produce an update it will have a
different number, which might as well be 3.1.8.

-- 
Peter Stephenson <pws@cambridgesiliconradio.com>
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


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

* Re: PATCH: Re: complete (real C) tags
  2000-05-25 12:18 Sven Wischnowsky
  2000-05-25 13:02 ` Thomas Köhler
@ 2000-05-25 14:41 ` Bart Schaefer
  1 sibling, 0 replies; 11+ messages in thread
From: Bart Schaefer @ 2000-05-25 14:41 UTC (permalink / raw)
  To: Sven Wischnowsky, zsh-workers

On May 25,  2:18pm, Sven Wischnowsky wrote:
} Subject: Re: PATCH: Re: complete (real C) tags
}
} Thomas Koehler wrote:
} 
} > Sorry for not having tested zsh-3.1.7-pre-versions so far (I'm still
} > using zsh-3.1.6-dev-21/22)... I have a (smaller) issue with make
} > completion: when there are multiple targets in one line, it won't work
} > as expected.
} > 
} > So, is it possible to change completion so that it recognizes these
} > rules, too?
} 
} This has long been fixed. Maybe upgrading to 3.1.7 next week? ;-)

It's still broken for cases like this:

all install uninstall tools config configure proto depend lint tags \
	types test testclean clean distclean:
	cd src && $(MAKE) $@

The above works for GNU make because make is actually executed to output
the list of targets, but the awk script used for other makes handles
neither backslashed newlines nor tabs embedded in the list of targets.

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


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

* Re: PATCH: Re: complete (real C) tags
  2000-05-25 12:18 Sven Wischnowsky
@ 2000-05-25 13:02 ` Thomas Köhler
  2000-05-25 14:41 ` Bart Schaefer
  1 sibling, 0 replies; 11+ messages in thread
From: Thomas Köhler @ 2000-05-25 13:02 UTC (permalink / raw)
  To: zsh-workers

On Thu, May 25, 2000 at 02:19:18PM +0200,
Sven Wischnowsky <wischnow@informatik.hu-berlin.de> wrote:
> 
> Thomas Koehler wrote:
> 
> > ...
> > 
> > --7AUc2qLy4jB3hD7Z
> > Content-Type: text/plain; charset=iso-8859-1
> > Content-Disposition: inline
> > Content-Transfer-Encoding: quoted-printable
> 
> Urgh...

Well, that strange character in my name requires strange encodings :)
(and, well... that GPG-signature... just left it out this time)

> > ...
> > 
> > Sorry for not having tested zsh-3.1.7-pre-versions so far (I'm still
> > using zsh-3.1.6-dev-21/22)... I have a (smaller) issue with make
> > completion: when there are multiple targets in one line, it won't work
> > as expected. Example (from vim's toplevel Makefile):
> > 
> > all install uninstall tools config configure proto depend lint tags types t=
> > est testclean clean distclean:
> >         cd src && $(MAKE) $@
> > 
> > Now, tab won't complete any of these rules...
> > So, is it possible to change completion so that it recognizes these
> > rules, too?
> 
> This has long been fixed. Maybe upgrading to 3.1.7 next week? ;-)

Well, yes then :-)

> Bye
>  Sven

CU,
Thomas

-- 
 Thomas Köhler Email:   jean-luc@picard.franken.de     | LCARS - Linux
     <><        WWW:     http://jeanluc-picard.de      | for Computers
                IRC:             jeanluc               | on All Real
               PGP public key available from Homepage! | Starships


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

* Re: PATCH: Re: complete (real C) tags
@ 2000-05-25 12:18 Sven Wischnowsky
  2000-05-25 13:02 ` Thomas Köhler
  2000-05-25 14:41 ` Bart Schaefer
  0 siblings, 2 replies; 11+ messages in thread
From: Sven Wischnowsky @ 2000-05-25 12:18 UTC (permalink / raw)
  To: zsh-workers


Thomas Koehler wrote:

> ...
> 
> --7AUc2qLy4jB3hD7Z
> Content-Type: text/plain; charset=iso-8859-1
> Content-Disposition: inline
> Content-Transfer-Encoding: quoted-printable

Urgh...

> ...
> 
> Sorry for not having tested zsh-3.1.7-pre-versions so far (I'm still
> using zsh-3.1.6-dev-21/22)... I have a (smaller) issue with make
> completion: when there are multiple targets in one line, it won't work
> as expected. Example (from vim's toplevel Makefile):
> 
> all install uninstall tools config configure proto depend lint tags types t=
> est testclean clean distclean:
>         cd src && $(MAKE) $@
> 
> Now, tab won't complete any of these rules...
> So, is it possible to change completion so that it recognizes these
> rules, too?

This has long been fixed. Maybe upgrading to 3.1.7 next week? ;-)

Bye
 Sven


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


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

* Re: PATCH: Re: complete (real C) tags
  2000-05-24  9:00 ` Peter Stephenson
@ 2000-05-24  9:09   ` Thomas Köhler
  0 siblings, 0 replies; 11+ messages in thread
From: Thomas Köhler @ 2000-05-24  9:09 UTC (permalink / raw)
  To: Zsh hackers list

[-- Attachment #1: Type: text/plain, Size: 1332 bytes --]

On Wed, May 24, 2000 at 11:02:40AM +0200,
Peter Stephenson <pws@cambridgesiliconradio.com> wrote:
> 
> > When entering the pre-3.1.7 state you said that we shouldn't apply
> > patches that change many files, so I'm withholding this patch until I
> > get a `go ahead'.
> 
> Things seem to have settled down, so I'd like to release 3.1.7 this weekend
> or shortly after.  It doesn't look like this patch will cause any trouble,
> but at this stage it might be best to wait until after.

Sorry for not having tested zsh-3.1.7-pre-versions so far (I'm still
using zsh-3.1.6-dev-21/22)... I have a (smaller) issue with make
completion: when there are multiple targets in one line, it won't work
as expected. Example (from vim's toplevel Makefile):

all install uninstall tools config configure proto depend lint tags types test testclean clean distclean:
        cd src && $(MAKE) $@

Now, tab won't complete any of these rules...
So, is it possible to change completion so that it recognizes these
rules, too?

CU,
Thomas

-- 
 Thomas Köhler Email:   jean-luc@picard.franken.de     | LCARS - Linux
     <><        WWW:     http://jeanluc-picard.de      | for Computers
                IRC:             jeanluc               | on All Real
               PGP public key available from Homepage! | Starships

[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]

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

* Re: PATCH: Re: complete (real C) tags
  2000-05-24  8:00 Sven Wischnowsky
@ 2000-05-24  9:00 ` Peter Stephenson
  2000-05-24  9:09   ` Thomas Köhler
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Stephenson @ 2000-05-24  9:00 UTC (permalink / raw)
  To: Zsh hackers list

> When entering the pre-3.1.7 state you said that we shouldn't apply
> patches that change many files, so I'm withholding this patch until I
> get a `go ahead'.

Things seem to have settled down, so I'd like to release 3.1.7 this weekend
or shortly after.  It doesn't look like this patch will cause any trouble,
but at this stage it might be best to wait until after.

-- 
Peter Stephenson <pws@cambridgesiliconradio.com>
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


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

* Re: PATCH: Re: complete (real C) tags
@ 2000-05-24  8:00 Sven Wischnowsky
  2000-05-24  9:00 ` Peter Stephenson
  0 siblings, 1 reply; 11+ messages in thread
From: Sven Wischnowsky @ 2000-05-24  8:00 UTC (permalink / raw)
  To: zsh-workers


Peter Stephenson wrote:

> > This adds -a to make the words be used as names of arrays
> > (actually I used get_user_var(), so '(foo bar)' is possible, should we 
> > document this?) and complete their values. It also adds -k to make the 
> > words be taken as names of assocs and complete their keys.
> 
> That's a huge improvement.  Here is _complete_tag.

When entering the pre-3.1.7 state you said that we shouldn't apply
patches that change many files, so I'm withholding this patch until I
get a `go ahead'.

It changes the places I found by a `grep compadd' to use -[ak]... in
66 files. It also makes the utility functions like _wanted and
_all_labels use only parameters named __* so that they shouldn't be in 
the way anymore. Id does not change _arguments and friends to use this 
convention, but that should seldom be a problem, especially if one
uses parameters named like_this in the calling function.

So, should I commit it?

Bye
 Sven

Index: Completion/Base/_combination
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/_combination,v
retrieving revision 1.1.1.10
diff -u -r1.1.1.10 _combination
--- Completion/Base/_combination	2000/02/28 09:45:32	1.1.1.10
+++ Completion/Base/_combination	2000/05/24 07:11:08
@@ -88,7 +88,7 @@
   fi
   tmp=( ${tmp%%${~sep}*} )
 
-  compadd "$@" - $tmp || { (( $+functions[_$key] )) && "_$key" "$@" }
+  compadd "$@" -a tmp || { (( $+functions[_$key] )) && "_$key" "$@" }
 else
   (( $+functions[_$key] )) && "_$key" "$@"
 fi
Index: Completion/Base/_command_names
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/_command_names,v
retrieving revision 1.1.1.16
diff -u -r1.1.1.16 _command_names
--- Completion/Base/_command_names	2000/02/04 12:14:06	1.1.1.16
+++ Completion/Base/_command_names	2000/05/24 07:11:08
@@ -7,7 +7,7 @@
 local args defs
 
 defs=(
-  'commands:external command:compadd - ${(@k)commands}'
+  'commands:external command:compadd -k commands'
   'executables:executable file or directory:_path_files -/g \*\(-\*\)'
 )
 
@@ -17,10 +17,10 @@
   [[ "$1" = - ]] && shift
 
   defs=( "$defs[@]"
-    'builtins:builtin command:compadd - ${(@k)builtins}'
-    'functions:shell function:compadd - ${(@k)functions}'
-    'aliases:alias:compadd - ${(@k)aliases}'
-    'reserved-words:reserved word:compadd - ${(@k)reswords}'
+    'builtins:builtin command:compadd -k builtins'
+    'functions:shell function:compadd -k functions'
+    'aliases:alias:compadd -k aliases'
+    'reserved-words:reserved word:compadd -k reswords'
     'jobs:: _jobs -t'
     'parameters:: _parameters -qS= -r "\n\t\- =["'
   )
Index: Completion/Base/_describe
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/_describe,v
retrieving revision 1.4
diff -u -r1.4 _describe
--- Completion/Base/_describe	2000/04/25 09:48:09	1.4
+++ Completion/Base/_describe	2000/05/24 07:11:08
@@ -52,8 +52,8 @@
         fi
       fi
 
-      compadd "$_args[@]" "$_expl[@]" -ld _tmpd - "$_tmpmd[@]" && _ret=0
-      compadd "$_args[@]" "$_expl[@]" -d _tmps  - "$_tmpms[@]" && _ret=0
+      compadd "$_args[@]" "$_expl[@]" -ld _tmpd -a _tmpmd && _ret=0
+      compadd "$_args[@]" "$_expl[@]" -d _tmps  -a _tmpms && _ret=0
     done
   done
   (( _ret )) || return 0
Index: Completion/Base/_equal
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/_equal,v
retrieving revision 1.1.1.7
diff -u -r1.1.1.7 _equal
--- Completion/Base/_equal	1999/11/15 12:01:46	1.1.1.7
+++ Completion/Base/_equal	2000/05/24 07:11:08
@@ -5,5 +5,5 @@
 args=( "$@" )
 
 _alternative -O args \
-    'commands:command:compadd - ${(@k)commands}' \
-    'aliases:alias:compadd - ${(@k)aliases}'
+    'commands:command:compadd -k commands' \
+    'aliases:alias:compadd -k aliases'
Index: Completion/Base/_subscript
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/_subscript,v
retrieving revision 1.2
diff -u -r1.2 _subscript
--- Completion/Base/_subscript	2000/04/01 20:43:43	1.2
+++ Completion/Base/_subscript	2000/05/24 07:11:08
@@ -12,7 +12,7 @@
   [[ "$RBUFFER" != \]* ]] && suf=']'
 
   _wanted association-keys expl 'association key' \
-      compadd -S "$suf" - "${(@kP)${compstate[parameter]}}"
+      compadd -S "$suf" -k "$compstate[parameter]"
 elif [[ ${(Pt)${compstate[parameter]}} = array* ]]; then
   local list i j ret=1 disp
 
@@ -39,10 +39,10 @@
 
       if [[ "$RBUFFER" = \]* ]]; then
         _all_labels -V indexes expl 'array index' \
-            compadd -S '' "$disp[@]" - "$ind[@]" && ret=0
+            compadd -S '' "$disp[@]" -a ind && ret=0
       else
         _all_labels -V indexes expl 'array index' \
-            compadd -S ']' "$disp[@]" - "$ind[@]" && ret=0
+            compadd -S ']' "$disp[@]" -a ind && ret=0
       fi
     fi
     _requested parameters && _parameters && ret=0
Index: Completion/Base/_tilde
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/_tilde,v
retrieving revision 1.4
diff -u -r1.4 _tilde
--- Completion/Base/_tilde	2000/05/16 11:24:55	1.4
+++ Completion/Base/_tilde	2000/05/24 07:11:08
@@ -2,7 +2,7 @@
 
 # We use all named directories and user names here. If this is too slow
 # for you or if there are too many of them, you may want to use
-# `compadd -qS/ - "$friends[@]"' or something like that.
+# `compadd -qS/ -a friends' or something like that.
 
 [[ -n "$compstate[quote]" ]] && return 1
 
@@ -22,7 +22,7 @@
   _requested users && _users "$suf[@]" "$@" && ret=0
 
   _requested named-directories expl 'named directory' \
-      compadd "$suf[@]" "$@" - "${(@k)nameddirs}"
+      compadd "$suf[@]" "$@" -k nameddirs
 
   if _requested directory-stack &&
      { ! zstyle -T ":completion:${curcontext}:directory-stack" prefix-needed ||
@@ -50,7 +50,7 @@
       disp=()
     fi
     _all_labels -V directory-stack expl 'directory stack' \
-        compadd "$suf[@]" "$disp[@]" -Q - "$list[@]" && ret=0
+        compadd "$suf[@]" "$disp[@]" -Q -a list && ret=0
   fi
   (( ret )) || return 0
 done
Index: Completion/Base/_value
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/_value,v
retrieving revision 1.3
diff -u -r1.3 _value
--- Completion/Base/_value	2000/04/18 12:26:31	1.3
+++ Completion/Base/_value	2000/05/24 07:11:08
@@ -10,7 +10,7 @@
           "${(Pt)${compstate[parameter]}}" = assoc* ]]; then
     if (( CURRENT & 1 )); then
       _wanted association-keys expl 'association key' \
-          compadd - "${(@kP)${compstate[parameter]}}"
+          compadd -k "$compstate[parameter]"
     else
       compstate[parameter]="${compstate[parameter]}-${words[CURRENT-1]}"
       _value "$@"
Index: Completion/Builtins/_aliases
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_aliases,v
retrieving revision 1.1.1.10
diff -u -r1.1.1.10 _aliases
--- Completion/Builtins/_aliases	1999/11/15 12:01:47	1.1.1.10
+++ Completion/Builtins/_aliases	2000/05/24 07:11:08
@@ -3,5 +3,5 @@
 local expl
 
 _alternative \
-  'aliases:regular alias:compadd - ${(@k)aliases}' \
-  'global-aliases:global alias:compadd - ${(@k)galiases}'
+  'aliases:regular alias:compadd -k aliases' \
+  'global-aliases:global alias:compadd -k galiases'
Index: Completion/Builtins/_bindkey
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_bindkey,v
retrieving revision 1.4
diff -u -r1.4 _bindkey
--- Completion/Builtins/_bindkey	2000/05/05 13:38:46	1.4
+++ Completion/Builtins/_bindkey	2000/05/24 07:11:08
@@ -29,9 +29,9 @@
 
 case $state in
   keymap)
-    _wanted -C -M keymaps expl keymap compadd - "$keymaps[@]"
+    _wanted -C -M keymaps expl keymap compadd -a keymaps
   ;;
   widget)
-    _wanted widgets expl widget compadd -M 'r:|-=* r:|=*' - "${(@k)widgets}"
+    _wanted widgets expl widget compadd -M 'r:|-=* r:|=*' -k widgets
   ;;
 esac
Index: Completion/Builtins/_builtin
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_builtin,v
retrieving revision 1.1.1.9
diff -u -r1.1.1.9 _builtin
--- Completion/Builtins/_builtin	2000/03/23 04:19:27	1.1.1.9
+++ Completion/Builtins/_builtin	2000/05/24 07:11:08
@@ -7,5 +7,5 @@
 else
   local expl
 
-  _wanted commands expl 'builtin command' compadd "$@" - "${(k@)builtins}"
+  _wanted commands expl 'builtin command' compadd "$@" -k builtins
 fi
Index: Completion/Builtins/_cd
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_cd,v
retrieving revision 1.2
diff -u -r1.2 _cd
--- Completion/Builtins/_cd	2000/04/01 20:43:43	1.2
+++ Completion/Builtins/_cd	2000/05/24 07:11:08
@@ -22,7 +22,7 @@
   rep=(${~PWD/$words[2]/*}~$PWD(-/N))
   # Now remove all the common parts of $PWD and the completions from this
   rep=(${${rep#${PWD%%$words[2]*}}%${PWD#*$words[2]}})
-  (( $#rep )) && _wanted -C replacement strings expl replacement compadd $rep
+  (( $#rep )) && _wanted -C replacement strings expl replacement compadd -a rep
 elif _popd || [[ $PREFIX != (\~|/|./|../)* && $#cdpath -ne 0 ]]; then
   local tdir tdir2
 
Index: Completion/Builtins/_command
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_command,v
retrieving revision 1.1.1.9
diff -u -r1.1.1.9 _command
--- Completion/Builtins/_command	2000/03/23 04:19:27	1.1.1.9
+++ Completion/Builtins/_command	2000/05/24 07:11:08
@@ -6,5 +6,5 @@
 else
   local expl
 
-  _wanted commands expl 'external command' compadd "$@" - "${(k@)commands}"
+  _wanted commands expl 'external command' compadd "$@" -k commands
 fi
Index: Completion/Builtins/_compdef
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_compdef,v
retrieving revision 1.5
diff -u -r1.5 _compdef
--- Completion/Builtins/_compdef	2000/05/05 13:38:46	1.5
+++ Completion/Builtins/_compdef	2000/05/24 07:11:08
@@ -25,16 +25,16 @@
 
 case $state in
   ccom)
-    _wanted commands expl 'completed command' compadd - ${(k)_comps}
+    _wanted commands expl 'completed command' compadd -k _comps
   ;;
   cfun)
     list=( ${^fpath:/.}/_(|*[^~])(N:t) )
     if zstyle -T ":completion:${curcontext}:functions" prefix-hidden; then
       disp=( ${list[@]#_} )
       _wanted functions expl 'completion function' \
-          compadd -d disp - "$list[@]"
+          compadd -d disp -a list
     else
-      _wanted functions expl 'completion function' compadd - "$list[@]"
+      _wanted functions expl 'completion function' compadd -a list
     fi
   ;;
   style)
Index: Completion/Builtins/_functions
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_functions,v
retrieving revision 1.1.1.10
diff -u -r1.1.1.10 _functions
--- Completion/Builtins/_functions	2000/03/23 04:19:27	1.1.1.10
+++ Completion/Builtins/_functions	2000/05/24 07:11:08
@@ -2,4 +2,4 @@
 
 local expl
 
-_wanted functions expl 'shell function' compadd "$@" - "${(k@)functions}"
+_wanted functions expl 'shell function' compadd "$@" -k functions
Index: Completion/Builtins/_hash
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_hash,v
retrieving revision 1.5
diff -u -r1.5 _hash
--- Completion/Builtins/_hash	2000/05/15 00:31:20	1.5
+++ Completion/Builtins/_hash	2000/05/24 07:11:08
@@ -28,11 +28,11 @@
       _wanted -C value files expl directories _path_files -/
     else
       _wanted -C name named-directories expl 'named directory' \
-          compadd -q -S '=' - "${(@k)nameddirs}"
+          compadd -q -S '=' -k nameddirs
     fi
   elif compset -P 1 '*='; then
     _wanted -C value values expl 'executable file' _files -g '*(-*)'
   else
-    _wanted -C name commands expl command compadd -q -S '=' - "${(@k)commands}"
+    _wanted -C name commands expl command compadd -q -S '=' -k commands
   fi
 fi
Index: Completion/Builtins/_popd
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_popd,v
retrieving revision 1.3
diff -u -r1.3 _popd
--- Completion/Builtins/_popd	2000/04/11 07:57:56	1.3
+++ Completion/Builtins/_popd	2000/05/24 07:11:08
@@ -38,4 +38,4 @@
 fi
 
 _wanted -V directory-stack expl 'directory stack' \
-    compadd "$@" "$disp[@]" -Q - "$list[@]"
+    compadd "$@" "$disp[@]" -Q -a list
Index: Completion/Builtins/_unhash
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_unhash,v
retrieving revision 1.1.1.11
diff -u -r1.1.1.11 _unhash
--- Completion/Builtins/_unhash	1999/12/30 18:28:37	1.1.1.11
+++ Completion/Builtins/_unhash	2000/05/24 07:11:08
@@ -4,10 +4,10 @@
 
 args=()
 [[ "$fl" = -*d* ]] &&
-    args=( 'named-directories:named directory:compadd - ${(@k)nameddirs}' )
+    args=( 'named-directories:named directory:compadd -k nameddirs' )
 [[ "$fl" = -*a* ]] &&
     args=( "$args[@]"
-           'aliases:alias:compadd - ${(@k)aliases} ${(@k)galiases} ${(@k)dis-aliases} ${(@k)dis-galiases}' )
+           'aliases:alias:compadd -k aliases galiases dis-aliases dis-galiases' )
 [[ "$fl" != -* ]] &&
     args=( 'commands:: _command_names -e' )
 
Index: Completion/Builtins/_vars
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_vars,v
retrieving revision 1.2
diff -u -r1.2 _vars
--- Completion/Builtins/_vars	2000/04/11 07:57:56	1.2
+++ Completion/Builtins/_vars	2000/05/24 07:11:08
@@ -17,7 +17,7 @@
     local expl
 
     _wanted -C subscript association-keys expl 'association key' \
-        compadd $addclose - ${(kP)var}
+        compadd $addclose -k "$var"
   fi
 else
   _parameters
Index: Completion/Builtins/_which
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_which,v
retrieving revision 1.1.1.9
diff -u -r1.1.1.9 _which
--- Completion/Builtins/_which	1999/11/15 12:01:47	1.1.1.9
+++ Completion/Builtins/_which	2000/05/24 07:11:08
@@ -5,8 +5,8 @@
 args=( "$@" )
 
 _alternative -O args \
-  'commands:external command:compadd - ${(k@)commands}' \
-  'builtins:builtin command:compadd - ${(k@)builtins}' \
-  'functions:shell function:compadd - ${(k@)functions}' \
-  'aliases:alias:compadd - ${(k@)aliases}' \
-  'reserved-words:reserved word:compadd - ${(k@)reswords}'
+  'commands:external command:compadd -k commands' \
+  'builtins:builtin command:compadd -k builtins' \
+  'functions:shell function:compadd -k functions' \
+  'aliases:alias:compadd -k aliases' \
+  'reserved-words:reserved word:compadd -k reswords'
Index: Completion/Builtins/_zcompile
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_zcompile,v
retrieving revision 1.4
diff -u -r1.4 _zcompile
--- Completion/Builtins/_zcompile	2000/05/05 13:38:46	1.4
+++ Completion/Builtins/_zcompile	2000/05/24 07:11:08
@@ -17,7 +17,7 @@
     '*:function:->function' && return 0
 
 if (( $+opt_args[-c] )); then
-  _wanted functions expl 'function to write' compadd - ${(k)functions}
+  _wanted functions expl 'function to write' compadd -k functions
 else
   _description files expl 'zsh source file'
   _files "$expl[@]"
Index: Completion/Builtins/_zle
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_zle,v
retrieving revision 1.1.1.9
diff -u -r1.1.1.9 _zle
--- Completion/Builtins/_zle	2000/03/23 04:19:27	1.1.1.9
+++ Completion/Builtins/_zle	2000/05/24 07:11:08
@@ -4,7 +4,7 @@
 
 if [[ "$words[2]" = -N && CURRENT -eq 3 ]]; then
   _wanted -C -N functions expl 'widget shell function' \
-      compadd "$@" - "${(k@)functions}"
+      compadd "$@" -k functions
 else
-  _wanted widgets expl widget compadd - "${(@k)widgets}"
+  _wanted widgets expl widget compadd -k widgets
 fi
Index: Completion/Builtins/_zmodload
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_zmodload,v
retrieving revision 1.1.1.16
diff -u -r1.1.1.16 _zmodload
--- Completion/Builtins/_zmodload	2000/03/23 04:19:27	1.1.1.16
+++ Completion/Builtins/_zmodload	2000/05/24 07:11:08
@@ -3,9 +3,9 @@
 local fl="$words[2]" expl
 
 if [[ "$fl" = -*(a*u|u*a)* || "$fl" = -*a* && CURRENT -ge 4 ]]; then
-  _wanted builtins expl 'builtin command' compadd "$@" - "${(k@)builtins}"
+  _wanted builtins expl 'builtin command' compadd "$@" -k builtins
 elif [[ "$fl" = -*u* ]]; then
-  _wanted modules expl module compadd - "${(@k)modules}"
+  _wanted modules expl module compadd -k modules
 else
   _wanted files expl 'module file' _files -W module_path -/g '*.s[ol](:r)'
 fi
Index: Completion/Builtins/_zpty
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_zpty,v
retrieving revision 1.5
diff -u -r1.5 _zpty
--- Completion/Builtins/_zpty	2000/05/05 13:38:46	1.5
+++ Completion/Builtins/_zpty	2000/05/24 07:11:08
@@ -17,8 +17,8 @@
   names=( ${list%%:*} )
   if zstyle -T ":completion:${curcontext}" verbose; then
     zformat -a list ' --' ${${(f)"$(zpty)"}#*\) }
-    _wanted names expl 'zpty command names' compadd -d list - "$names[@]"
+    _wanted names expl 'zpty command names' compadd -d list -a names
   else
-    _wanted names expl 'zpty command names' compadd - "$names[@]"
+    _wanted names expl 'zpty command names' compadd -a names
   fi
 fi
Index: Completion/Builtins/_zstyle
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_zstyle,v
retrieving revision 1.13
diff -u -r1.13 _zstyle
--- Completion/Builtins/_zstyle	2000/05/17 15:54:38	1.13
+++ Completion/Builtins/_zstyle	2000/05/24 07:11:08
@@ -151,7 +151,7 @@
     completer)
       _wanted values expl completer \
 	compadd _complete _approximate _correct _match \
-                _expand _list _menu _oldlist _next_tags
+                _expand _list _menu _oldlist _ignored _prefix _history
       ;;
 
     fsort)
@@ -212,7 +212,7 @@
       elif compset -P '*:'; then
         _message 'tag alias'
       else
-        _wanted tags expl tag compadd - $taglist
+        _wanted tags expl tag compadd -a taglist
       fi
       ;;
 
Index: Completion/Commands/_bash_completions
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Commands/_bash_completions,v
retrieving revision 1.2
diff -u -r1.2 _bash_completions
--- Completion/Commands/_bash_completions	2000/04/26 13:13:52	1.2
+++ Completion/Commands/_bash_completions	2000/05/24 07:11:08
@@ -28,12 +28,13 @@
 setopt localoptions nullglob rcexpandparam extendedglob
 unsetopt markdirs globsubst shwordsplit nounset ksharrays
 
-local key=$KEYS[-1]
+local key=$KEYS[-1] expl
 
 case $key in
   '!') _main_complete _command_names
        ;;
-  '$') compadd - "${(@k)parameters[(R)*export*]}"
+  '$') _main_complete - _wanted parameters expl 'exported parameters' \
+                            compadd - "${(@k)parameters[(R)*export*]}"
        ;;
   '@') _main_complete _hosts
        ;;
Index: Completion/Commands/_history_complete_word
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Commands/_history_complete_word,v
retrieving revision 1.3
diff -u -r1.3 _history_complete_word
--- Completion/Commands/_history_complete_word	2000/04/26 13:13:52	1.3
+++ Completion/Commands/_history_complete_word	2000/05/24 07:11:08
@@ -70,7 +70,7 @@
 }
 
 _history_complete_word_gen_matches () {
-  local opt
+  local opt h_words
 
   [[ -n "$_hist_stop" ]] && PREFIX="$_hist_old_prefix"
 
@@ -85,8 +85,9 @@
     opt="${opt}V"
   fi
 
+  h_words=( "${(@)historywords[2,-1]}" )
   _wanted "$opt" history-words expl 'history word' \
-      compadd -Q - "$historywords[@]"
+      compadd -Q -a h_words
 
   zstyle -t ":completion:${curcontext}:history-words" list ||
       compstate[list]=
Index: Completion/Core/_all_labels
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_all_labels,v
retrieving revision 1.4
diff -u -r1.4 _all_labels
--- Completion/Core/_all_labels	2000/05/08 08:16:32	1.4
+++ Completion/Core/_all_labels	2000/05/24 07:11:08
@@ -1,43 +1,43 @@
 #autoload
 
-local gopt=-J len tmp pre suf ret=1 descr spec prev
+local __gopt=-J __len __tmp __pre __suf __ret=1 __descr __spec __prev
 
 if [[ "$1" = - ]]; then
-  prev=-
+  __prev=-
   shift
 fi
 
 if [[ "$1" = -([12]|)[VJ] ]]; then
-  gopt="$1"
+  __gopt="$1"
   shift
 fi
 
-tmp=${argv[(ib:4:)-]}
-len=$#
-if [[ tmp -lt len ]]; then
-  pre=$(( tmp-1 ))
-  suf=$tmp
-elif [[ tmp -eq $# ]]; then
-  pre=-2
-  suf=$(( len+1 ))
+__tmp=${argv[(ib:4:)-]}
+__len=$#
+if [[ __tmp -lt __len ]]; then
+  __pre=$(( __tmp-1 ))
+  __suf=$__tmp
+elif [[ __tmp -eq $# ]]; then
+  __pre=-2
+  __suf=$(( __len+1 ))
 else
-  pre=4
-  suf=5
+  __pre=4
+  __suf=5
 fi
 
-while comptags "-A$prev" "$1" curtag spec; do
-  _comp_tags="$_comp_tags $spec "
+while comptags "-A$__prev" "$1" curtag __spec; do
+  _comp_tags="$_comp_tags $__spec "
   if [[ "$curtag" = *:* ]]; then
-    zformat -f descr "${curtag#*:}" "d:$3"
-    _description "$gopt" "${curtag%:*}" "$2" "$descr"
+    zformat -f __descr "${curtag#*:}" "d:$3"
+    _description "$__gopt" "${curtag%:*}" "$2" "$__descr"
     curtag="${curtag%:*}"
 
-    "$4" "${(P@)2}" "${(@)argv[5,-1]}" && ret=0
+    "$4" "${(P@)2}" "${(@)argv[5,-1]}" && __ret=0
   else
-    _description "$gopt" "$curtag" "$2" "$3"
+    _description "$__gopt" "$curtag" "$2" "$3"
 
-    "${(@)argv[4,pre]}" "${(P@)2}" "${(@)argv[suf,-1]}" && ret=0
+    "${(@)argv[4,__pre]}" "${(P@)2}" "${(@)argv[__suf,-1]}" && __ret=0
   fi
 done
 
-return ret
+return __ret
Index: Completion/Core/_expand
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_expand,v
retrieving revision 1.12
diff -u -r1.12 _expand
--- Completion/Core/_expand	2000/05/22 08:47:30	1.12
+++ Completion/Core/_expand	2000/05/24 07:11:08
@@ -104,7 +104,7 @@
     _description -V expansions expl expansions "o:$word"
   fi
 
-  compadd "$expl[@]" -UQ -qS "$suf" - "$exp[@]"
+  compadd "$expl[@]" -UQ -qS "$suf" -a exp
 else
   _tags all-expansions expansions original
 
@@ -142,8 +142,8 @@
 	normal=( "$normal[@]" "$i" )
       fi
     done
-    (( $#dir ))    && compadd "$expl[@]" -UQ -qS/ - "$dir[@]"
-    (( $#normal )) && compadd "$expl[@]" -UQ -qS "$suf" - "$normal[@]"
+    (( $#dir ))    && compadd "$expl[@]" -UQ -qS/ -a dir
+    (( $#normal )) && compadd "$expl[@]" -UQ -qS "$suf" -a normal
   fi
 
   _requested original expl original && compadd "$expl[@]" -UQ - "$word"
Index: Completion/Core/_file_descriptors
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_file_descriptors,v
retrieving revision 1.1
diff -u -r1.1 _file_descriptors
--- Completion/Core/_file_descriptors	2000/04/20 00:48:28	1.1
+++ Completion/Core/_file_descriptors	2000/05/24 07:11:08
@@ -17,7 +17,7 @@
       list=( ${list[@]} "$i -- $(ls -l /proc/$$/fd/$i|sed 's/.*-> //' )" )
     done
   fi
-  _wanted file-descriptors expl 'file descriptors' compadd "$@" -d list - "$fds[@]"  
+  _wanted file-descriptors expl 'file descriptors' compadd "$@" -d list -a fds
 else
-  _wanted file-descriptors expl 'file descriptors' compadd "$@" - "$fds[@]"
+  _wanted file-descriptors expl 'file descriptors' compadd "$@" -a fds
 fi
Index: Completion/Core/_history
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_history,v
retrieving revision 1.1
diff -u -r1.1 _history
--- Completion/Core/_history	2000/04/27 14:16:15	1.1
+++ Completion/Core/_history	2000/05/24 07:11:08
@@ -16,7 +16,7 @@
 #                          remove /all/ duplicate matches rather than just
 #                          consecutives
 
-local opt expl 
+local opt expl h_words
 
 if zstyle -t ":completion:${curcontext}:" remove-all-dups; then
   opt=-
@@ -32,5 +32,5 @@
 
 # We skip the first element of historywords so the current word doesn't
 # interfere with the completion
-_wanted "$opt" history-words expl 'history word' \
-    compadd -Q - "${(@)historywords[2,-1]}"
+h_words=( "${(@)historywords[2,-1]}" )
+_wanted "$opt" history-words expl 'history word' compadd -Q -a h_words
Index: Completion/Core/_multi_parts
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_multi_parts,v
retrieving revision 1.2
diff -u -r1.2 _multi_parts
--- Completion/Core/_multi_parts	2000/05/19 08:26:48	1.2
+++ Completion/Core/_multi_parts	2000/05/24 07:11:08
@@ -59,7 +59,7 @@
 # If the string from the line matches at least one of the strings,
 # we use only the matching strings.
 
-compadd -O tmp1 -M "r:|${sep}=* r:|=* $matcher" - "$matches[@]"
+compadd -O tmp1 -M "r:|${sep}=* r:|=* $matcher" -a matches
 
 (( $#tmp1 )) && matches=( "$tmp1[@]" )
 
@@ -138,7 +138,7 @@
 
       PREFIX="$pre"
       SUFFIX="$suf"
-      compadd -O matches -M "r:|${sep}=* r:|=* $matcher" - "$matches[@]"
+      compadd -O matches -M "r:|${sep}=* r:|=* $matcher" -a matches
 
       if [[ "$pre" = *${sep}* ]]; then
  	PREFIX="${cpre}${pre%%${sep}*}"
Index: Completion/Core/_next_label
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_next_label,v
retrieving revision 1.4
diff -u -r1.4 _next_label
--- Completion/Core/_next_label	2000/05/23 08:54:30	1.4
+++ Completion/Core/_next_label	2000/05/24 07:11:08
@@ -1,21 +1,21 @@
 #autoload
 
-local gopt=-J descr spec
+local __gopt=-J __descr __spec
 
 if [[ "$1" = -([12]|)[VJ] ]]; then
-  gopt="$1"
+  __gopt="$1"
   shift
 fi
 
-if comptags -A "$1" curtag spec; then
-  _comp_tags="$_comp_tags $spec "
+if comptags -A "$1" curtag __spec; then
+  _comp_tags="$_comp_tags $__spec "
   if [[ "$curtag" = *:* ]]; then
-    zformat -f descr "${curtag#*:}" "d:$3"
-    _description "$gopt" "${curtag%:*}" "$2" "$descr"
+    zformat -f __descr "${curtag#*:}" "d:$3"
+    _description "$__gopt" "${curtag%:*}" "$2" "$__descr"
     curtag="${curtag%:*}"
     set -A $2 "${(P@)2}" "${(@)argv[4,-1]}"
   else
-    _description "$gopt" "$curtag" "$2" "$3"
+    _description "$__gopt" "$curtag" "$2" "$3"
     set -A $2 "${(@)argv[4,-1]}" "${(P@)2}"
   fi
 
Index: Completion/Core/_options
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_options,v
retrieving revision 1.1.1.6
diff -u -r1.1.1.6 _options
--- Completion/Core/_options	2000/03/23 04:19:28	1.1.1.6
+++ Completion/Core/_options	2000/05/24 07:11:08
@@ -5,4 +5,4 @@
 local expl
 
 _wanted zsh-options expl 'zsh option' \
-    compadd "$@" -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' - "${(@k)options}"
+    compadd "$@" -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -k options
Index: Completion/Core/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_path_files,v
retrieving revision 1.14
diff -u -r1.14 _path_files
--- Completion/Core/_path_files	2000/05/16 11:24:55	1.14
+++ Completion/Core/_path_files	2000/05/24 07:11:08
@@ -488,7 +488,7 @@
 	  compadd -Qf "$mopts[@]" -p "$linepath$tmp2" \
 	          -W "$prepath$realpath$testpath" \
 		   "$pfxsfx[@]" -M "r:|/=* r:|=*" \
-		   - "$tmp1[@]"
+		   -a tmp1
 	fi
       else
         if [[ "$tmp3" = */* ]]; then
@@ -502,7 +502,7 @@
 	  compadd -Qf "$mopts[@]" -p "$linepath$tmp2" \
                   -W "$prepath$realpath$testpath" \
 		  "$pfxsfx[@]" -M "r:|/=* r:|=*" \
-		  - "$tmp1[@]"
+		  -a tmp1
         fi
       fi
       tmp4=-
@@ -564,7 +564,7 @@
       tmp4="$testpath"
       compquote tmp4 tmp1
       compadd -Qf "$mopts[@]" -p "$linepath$tmp4" -W "$prepath$realpath$testpath" \
-	      "$pfxsfx[@]" -M "r:|/=* r:|=*" - "$tmp1[@]"
+	      "$pfxsfx[@]" -M "r:|/=* r:|=*" -a tmp1
     fi
   fi
 done
@@ -578,7 +578,7 @@
       "$exppaths" != "$eorig" ]]; then
   PREFIX="${opre}"
   SUFFIX="${osuf}"
-  compadd -Q "$mopts[@]" -S '' -M "r:|/=* r:|=*" -p "$linepath" - "$exppaths[@]"
+  compadd -Q "$mopts[@]" -S '' -M "r:|/=* r:|=*" -p "$linepath" -a exppaths
 fi
 
 [[ nm -ne compstate[nmatches] ]]
Index: Completion/Core/_requested
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_requested,v
retrieving revision 1.5
diff -u -r1.5 _requested
--- Completion/Core/_requested	2000/05/04 16:19:06	1.5
+++ Completion/Core/_requested	2000/05/24 07:11:08
@@ -1,17 +1,17 @@
 #autoload
 
-local gopt=-J
+local __gopt=-J
 
 if [[ "$1" = -([12]|)[VJ] ]]; then
-  gopt="$1"
+  __gopt="$1"
   shift
 fi
 
 if comptags -R "$1"; then
   if [[ $# -gt 3 ]]; then
-    _all_labels - "$gopt" "$@" || return 1
+    _all_labels - "$__gopt" "$@" || return 1
   elif [[ $# -gt 1 ]]; then
-    _description "$gopt" "$@"
+    _description "$__gopt" "$@"
   fi
   return 0
 else
Index: Completion/Core/_sep_parts
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_sep_parts,v
retrieving revision 1.2
diff -u -r1.2 _sep_parts
--- Completion/Core/_sep_parts	2000/05/19 08:26:48	1.2
+++ Completion/Core/_sep_parts	2000/05/24 07:11:08
@@ -58,9 +58,9 @@
   # Get the matching array elements.
 
   PREFIX="${str%%(|\\)${sep}*}"
-  builtin compadd -O testarr - "${(@P)arr}"
+  builtin compadd -O testarr -a "$arr"
   [[ $#testarr -eq 0 && -n "$_comp_correct" ]] &&
-    compadd -O testarr - "${(@P)arr}"
+    compadd -O testarr -a "$arr"
 
   # If there are no matches we give up. If there is more than one
   # match, this is the part we will complete.
@@ -88,9 +88,9 @@
   # No more separators, build the matches.
 
   PREFIX="$str"
-  builtin compadd -O testarr - "${(@P)arr}"
+  builtin compadd -O testarr -a "$arr"
   [[ $#testarr -eq 0 && -n "$_comp_correct" ]] &&
-    compadd -O testarr - "${(@P)arr}"
+    compadd -O testarr -a "$arr"
 fi
 
 [[ $#testarr -eq 0 || ${#testarr[1]} -eq 0 ]] && return 1
@@ -125,9 +125,9 @@
     arr=tmparr
   fi
 
-  builtin compadd -O tmparr - "${(@P)arr}"
+  builtin compadd -O tmparr -a "$arr"
   [[ $#tmparr -eq 0 && -n "$_comp_correct" ]] &&
-    compadd -O tmparr - "${(@P)arr}"
+    compadd -O tmparr - "$arr"
 
   suffixes=("${(@)^suffixes[@]}${(q)1}${(@)^tmparr}")
 
@@ -155,7 +155,7 @@
 SUFFIX="$suf"
 for i in "$suffixes[@]"; do
   compadd -U "$group[@]" "$expl[@]" "$matchers[@]" "$autosuffix[@]" "$opts[@]" \
-          -i "$IPREFIX" -I "$ISUFFIX" -p "$prefix" -s "$i" - "$testarr[@]"
+          -i "$IPREFIX" -I "$ISUFFIX" -p "$prefix" -s "$i" -a testarr
 done
 
 # This sets the return value to indicate that we added matches (or not).
Index: Completion/Core/_set_options
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_set_options,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 _set_options
--- Completion/Core/_set_options	2000/03/23 04:19:28	1.1.1.5
+++ Completion/Core/_set_options	2000/05/24 07:11:08
@@ -7,4 +7,4 @@
 local expl
 
 _wanted zsh-options expl 'set zsh option' \
-    compadd "$@" -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' - $=_set_options
+    compadd "$@" -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -a _set_options
Index: Completion/Core/_unset_options
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_unset_options,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 _unset_options
--- Completion/Core/_unset_options	2000/03/23 04:19:28	1.1.1.5
+++ Completion/Core/_unset_options	2000/05/24 07:11:08
@@ -7,4 +7,4 @@
 local expl
 
 _wanted zsh-options expl 'unset zsh option' \
-    compadd "$@" -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' - $=_unset_options
+    compadd "$@" -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -a _unset_options
Index: Completion/Core/_wanted
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_wanted,v
retrieving revision 1.3
diff -u -r1.3 _wanted
--- Completion/Core/_wanted	2000/04/11 07:57:57	1.3
+++ Completion/Core/_wanted	2000/05/24 07:11:08
@@ -1,26 +1,26 @@
 #autoload
 
-local targs gopt=-J
+local __targs __gopt=-J
 
 if [[ "$1" = -C?* ]]; then
-  targs=( -C "${1[3,-1]}" )
+  __targs=( -C "${1[3,-1]}" )
   shift
 elif [[ "$1" = -C ]]; then
-  targs=( -C "$2" )
+  __targs=( -C "$2" )
   shift 2
 else
-  targs=()
+  __targs=()
 fi
 
 if [[ "$1" = -([12]|)[VJ] ]]; then
-  gopt="$1"
+  __gopt="$1"
   shift
 fi
 
-_tags "$targs[@]" "$1"
+_tags "$__targs[@]" "$1"
 
 while _tags; do
-  _all_labels "$gopt" "$@" && return 0
+  _all_labels "$__gopt" "$@" && return 0
 done
 
 return 1
Index: Completion/User/_archie
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_archie,v
retrieving revision 1.2
diff -u -r1.2 _archie
--- Completion/User/_archie	2000/05/05 13:38:46	1.2
+++ Completion/User/_archie	2000/05/24 07:11:08
@@ -26,7 +26,7 @@
 serverhost)
   : ${(A)archie_servers:=${(M)$(_call hosts archie -L):#archie.*}}
 
-  _wanted hosts expl 'archie servers' compadd -  $archie_servers && return 0
+  _wanted hosts expl 'archie servers' compadd -a archie_servers && return 0
   ;;
 esac
 
Index: Completion/User/_cvs
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_cvs,v
retrieving revision 1.8
diff -u -r1.8 _cvs
--- Completion/User/_cvs	2000/05/16 16:04:04	1.8
+++ Completion/User/_cvs	2000/05/24 07:11:08
@@ -49,7 +49,7 @@
 	watchers "")
 
   if (( CURRENT == 1 )); then
-    _tags commands && { compadd "$@" ${(k)cmds} || compadd "$@" ${(kv)=cmds} }
+    _tags commands && { compadd "$@" -k cmds || compadd "$@" ${(kv)=cmds} }
   else
     local curcontext="$curcontext"
 
@@ -584,7 +584,7 @@
   fi
 
   _tags files && {
-    compadd -M 'r:|[:@./]=** r:|=**' "$@" $_cvs_roots || _files "$@" -/
+    compadd -M 'r:|[:@./]=** r:|=**' "$@" -a _cvs_roots || _files "$@" -/
   }
 }
 
@@ -652,7 +652,7 @@
       fi
     fi
     if (( $#_cvs_modules_cache )); then
-      _wanted modules expl 'module name' compadd - $_cvs_modules_cache
+      _wanted modules expl 'module name' compadd -a _cvs_modules_cache
     else
       _message 'module name'
     fi
@@ -683,7 +683,7 @@
   fi
 
   if (( $#_cvs_revisions_cache )); then
-    _wanted values expl revision compadd - $_cvs_revisions_cache
+    _wanted values expl revision compadd -a _cvs_revisions_cache
   else
     _message revision
   fi
@@ -813,7 +813,7 @@
       ${${${${(M)${(f)"$(<"$realdir"CVS/Entries)"}:#(D|)/*}#(D|)/}%%/*}:#${(j:|:)~${files//(#m)[][*?()<|^~#\\]/\\$MATCH}}}
     )
     compquote files
-    _wanted files expl file compadd -Qp "$linedir" $files
+    _wanted files expl file compadd -Qp -a linedir files
   }
 }
 
Index: Completion/User/_domains
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_domains,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 _domains
--- Completion/User/_domains	2000/03/23 04:19:29	1.1.1.4
+++ Completion/User/_domains	2000/05/24 07:11:08
@@ -17,4 +17,4 @@
 fi
 
 _wanted domains expl domain \
-    compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" - "$domains[@]"
+    compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" -a domains
Index: Completion/User/_gprof
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_gprof,v
retrieving revision 1.3
diff -u -r1.3 _gprof
--- Completion/User/_gprof	2000/05/02 08:23:31	1.3
+++ Completion/User/_gprof	2000/05/24 07:11:08
@@ -49,7 +49,7 @@
       expl=function
     fi
     _wanted functions expl "$expl" \
-        compadd -M 'r:|_=* r:|=*' - "$_gprof_funcs[@]" && ret=0
+        compadd -M 'r:|_=* r:|=*' -a _gprof_funcs && ret=0
   else
     return 1
   fi
Index: Completion/User/_groups
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_groups,v
retrieving revision 1.4
diff -u -r1.4 _groups
--- Completion/User/_groups	2000/05/11 16:14:58	1.4
+++ Completion/User/_groups	2000/05/24 07:11:08
@@ -16,4 +16,4 @@
   groups=( "$_cache_groups[@]" )
 fi
 
-_wanted groups expl group compadd "$@" - "$groups[@]"
+_wanted groups expl group compadd "$@" -a groups
Index: Completion/User/_hosts
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_hosts,v
retrieving revision 1.1.1.23
diff -u -r1.1.1.23 _hosts
--- Completion/User/_hosts	2000/03/23 04:19:29	1.1.1.23
+++ Completion/User/_hosts	2000/05/24 07:11:08
@@ -10,4 +10,4 @@
 fi
 
 _wanted hosts expl host \
-    compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" - "$hosts[@]"
+    compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" -a hosts
Index: Completion/User/_lp
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_lp,v
retrieving revision 1.5
diff -u -r1.5 _lp
--- Completion/User/_lp	2000/04/28 11:20:55	1.5
+++ Completion/User/_lp	2000/05/24 07:11:08
@@ -26,7 +26,7 @@
           else
   	  disp=()
           fi
-	  _all_labels users expl user compadd "$disp[@]" - "$strs[@]" ||
+	  _all_labels users expl user compadd "$disp[@]" -a strs ||
               _users && ret=0
         fi
         if _requested jobs; then
@@ -38,7 +38,7 @@
           else
   	  disp=()
           fi
-          _all_labels jobs expl job compadd "$disp[@]" - "$strs[@]" && ret=0
+          _all_labels jobs expl job compadd "$disp[@]" -a strs && ret=0
         fi
         (( ret )) || return 0
       done
Index: Completion/User/_mailboxes
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_mailboxes,v
retrieving revision 1.1.1.17
diff -u -r1.1.1.17 _mailboxes
--- Completion/User/_mailboxes	2000/03/25 00:21:50	1.1.1.17
+++ Completion/User/_mailboxes	2000/05/24 07:11:08
@@ -157,7 +157,7 @@
   esac
 
   (( $#mbox_names )) && _multi_parts "$@" / mbox_names && ret=0
-  (( $#mbox_short )) && compadd "$@" - "$mbox_short[@]" && ret=0
+  (( $#mbox_short )) && compadd "$@" -a mbox_short && ret=0
   return ret
 }
 
Index: Completion/User/_make
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_make,v
retrieving revision 1.9
diff -u -r1.9 _make
--- Completion/User/_make	2000/05/10 07:15:33	1.9
+++ Completion/User/_make	2000/05/24 07:11:08
@@ -42,7 +42,7 @@
  	     FS=: $file)
            )
     fi
-    _wanted targets expl 'make target' compadd "$tmp[@]" && return 0
+    _wanted targets expl 'make target' compadd -a tmp && return 0
   fi
   compset -P 1 '*='
   _files
Index: Completion/User/_mount
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_mount,v
retrieving revision 1.5
diff -u -r1.5 _mount
--- Completion/User/_mount	2000/05/03 11:25:12	1.5
+++ Completion/User/_mount	2000/05/24 07:11:09
@@ -540,7 +540,7 @@
   compset -P '*,'
 
   _wanted types expl 'file system type' \
-      compadd -qS, -M 'L:|no=' - "$fss[@]" && ret=0
+      compadd -qS, -M 'L:|no=' -a fss && ret=0
   ;;
 fsopt)
   _tags options || return 1
@@ -569,8 +569,8 @@
     mp_tmp=( "${(@)${(@)tmp#* }%% *}" )
 
     _alternative \
-        'devices:device:compadd - $dev_tmp[@]' \
-	'directories:mount point:compadd - $mp_tmp[@]' && ret=0
+        'devices:device:compadd -a dev_tmp' \
+	'directories:mount point:compadd -a mp_tmp' && ret=0
   fi
   ;;
 esac
Index: Completion/User/_mysql_utils
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_mysql_utils,v
retrieving revision 1.2
diff -u -r1.2 _mysql_utils
--- Completion/User/_mysql_utils	2000/04/05 11:28:09	1.2
+++ Completion/User/_mysql_utils	2000/05/24 07:11:09
@@ -64,7 +64,7 @@
                    )
   shift _mysql_databases
 
-  compadd "$expl[@]" - $_mysql_databases
+  compadd "$expl[@]" -a _mysql_databases
 }
 
 _mysql_tables () {
@@ -79,7 +79,7 @@
   # remove header
   shift _mysql_tables
 
-  compadd "$expl[@]" - $_mysql_tables
+  compadd "$expl[@]" -a _mysql_tables
 }
 
 _mysql_variables () {
@@ -205,7 +205,7 @@
        )
 
   if (( CURRENT == 1 )); then
-    _wanted commands expl command compadd "$@" - $cmds
+    _wanted commands expl command compadd "$@" -a cmds
   else
     local curcontext="$curcontext"
 
Index: Completion/User/_netscape
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_netscape,v
retrieving revision 1.7
diff -u -r1.7 _netscape
--- Completion/User/_netscape	2000/05/23 16:11:57	1.7
+++ Completion/User/_netscape	2000/05/24 07:11:09
@@ -62,8 +62,8 @@
     *)
       compset -S '(|\\)\(*' || suf="${${QIPREFIX:+(}:-\(}"
       _wanted commands expl 'remote commands' \
-          compadd -qS "$suf" -M 'm:{a-zA-Z}={A-Za-z}' - \
-                  $remote_commands && ret=0
+          compadd -qS "$suf" -M 'm:{a-zA-Z}={A-Za-z}' -a \
+                  remote_commands && ret=0
     ;;
   esac
 fi
Index: Completion/User/_perl
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_perl,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 _perl
--- Completion/User/_perl	2000/03/13 01:49:36	1.1.1.1
+++ Completion/User/_perl	2000/05/24 07:11:09
@@ -59,7 +59,7 @@
   (( compstate[quoting] )) && delimiter=' '
 
   compset -P '* ' && compset -q
-  compadd "$expl[@]" $add_colon -S$delimiter -q - $_perl_config_vars
+  compadd "$expl[@]" $add_colon -S$delimiter -q -a _perl_config_vars
 }
 
 _perl "$@"
Index: Completion/User/_perl_basepods
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_perl_basepods,v
retrieving revision 1.2
diff -u -r1.2 _perl_basepods
--- Completion/User/_perl_basepods	2000/05/23 18:06:32	1.2
+++ Completion/User/_perl_basepods	2000/05/24 07:11:09
@@ -29,4 +29,4 @@
 
 local expl
 
-_wanted pods expl 'Perl base pods' compadd - $_perl_basepods
+_wanted pods expl 'Perl base pods' compadd -a _perl_basepods
Index: Completion/User/_perl_builtin_funcs
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_perl_builtin_funcs,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 _perl_builtin_funcs
--- Completion/User/_perl_builtin_funcs	2000/03/23 04:19:30	1.1.1.5
+++ Completion/User/_perl_builtin_funcs	2000/05/24 07:11:09
@@ -28,4 +28,4 @@
 
 local expl
 
-_wanted functions expl 'Perl built-in functions' compadd - $_perl_builtin_funcs
+_wanted functions expl 'Perl built-in functions' compadd -a _perl_builtin_funcs
Index: Completion/User/_perl_modules
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_perl_modules,v
retrieving revision 1.4
diff -u -r1.4 _perl_modules
--- Completion/User/_perl_modules	2000/05/23 18:06:32	1.4
+++ Completion/User/_perl_modules	2000/05/24 07:11:09
@@ -60,4 +60,4 @@
 
 local expl
 
-_wanted modules expl 'Perl modules' compadd "$opts[@]" - $_perl_modules
+_wanted modules expl 'Perl modules' compadd "$opts[@]" -a _perl_modules
Index: Completion/User/_ports
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_ports,v
retrieving revision 1.1.1.9
diff -u -r1.1.1.9 _ports
--- Completion/User/_ports	2000/03/23 04:19:30	1.1.1.9
+++ Completion/User/_ports	2000/05/24 07:11:09
@@ -9,4 +9,4 @@
   ports=( "$_cache_ports[@]" )
 fi
 
-_wanted ports expl port compadd "$@" - "$ports[@]"
+_wanted ports expl port compadd "$@" -a ports
Index: Completion/User/_rcs
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_rcs,v
retrieving revision 1.2
diff -u -r1.2 _rcs
--- Completion/User/_rcs	2000/04/05 11:28:09	1.2
+++ Completion/User/_rcs	2000/05/24 07:11:09
@@ -8,5 +8,5 @@
   local rep expl
 
   rep=(RCS/$PREFIX*$SUFFIX,v(:t:s/\,v//))
-  (( $#rep )) && _wanted files expl 'RCS file' compadd - $rep
+  (( $#rep )) && _wanted files expl 'RCS file' compadd -a rep
 fi
Index: Completion/User/_urls
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_urls,v
retrieving revision 1.9
diff -u -r1.9 _urls
--- Completion/User/_urls	2000/05/23 16:11:57	1.9
+++ Completion/User/_urls	2000/05/24 07:11:09
@@ -124,7 +124,7 @@
       compset -S '/*' || suf="/"
       (( $#uhosts )) || _hosts -S "$suf" "$expl[@]" && ret=0
       [[ "$scheme" = http ]] && uhosts=($uhosts $localhttp_servername)
-      compadd -S "$suf" "$expl[@]" - $uhosts && ret=0
+      compadd -S "$suf" "$expl[@]" -a uhosts && ret=0
     done
     (( ret )) || return 0
   done
Index: Completion/User/_users
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_users,v
retrieving revision 1.3
diff -u -r1.3 _users
--- Completion/User/_users	2000/04/11 07:57:57	1.3
+++ Completion/User/_users	2000/05/24 07:11:09
@@ -3,6 +3,6 @@
 local expl users
 
 zstyle -a ":completion:${curcontext}:" users users &&
-    _wanted users expl user compadd "$@" - "$users[@]" && return 0
+    _wanted users expl user compadd "$@" -a users && return 0
 
-_wanted users expl user compadd "$@" - "${(@k)userdirs}"
+_wanted users expl user compadd "$@" -k userdirs
Index: Completion/User/_yp
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_yp,v
retrieving revision 1.2
diff -u -r1.2 _yp
--- Completion/User/_yp	2000/04/05 11:28:09	1.2
+++ Completion/User/_yp	2000/05/24 07:11:09
@@ -96,10 +96,10 @@
   while _tags; do
     # The `-M ...' allows `pa.n<TAB>' to complete to `passwd.byname'.
     _requested maps expl 'map name' \
-        compadd -M 'l:.|by=by l:.|=by r:|.=* r:|=*' - \
-                "$_yp_cache_maps[@]" && ret=0
+        compadd -M 'l:.|by=by l:.|=by r:|.=* r:|=*' -a \
+                _yp_cache_maps && ret=0
     _requested nicknames expl nicknames \
-        compadd - "$_yp_cache_nicks[@]" && ret=0
+        compadd -a _yp_cache_nicks && ret=0
     (( ret )) || return 0
   done
 elif [[ "$state" = servers ]]; then
Index: Completion/X/_x_color
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/_x_color,v
retrieving revision 1.2
diff -u -r1.2 _x_color
--- Completion/X/_x_color	2000/04/26 06:54:26	1.2
+++ Completion/X/_x_color	2000/05/24 07:11:09
@@ -31,5 +31,5 @@
 fi
 
 _wanted colors expl 'color specification' \
-    compadd "$@" -M 'm:{a-z}={A-Z} m:-=\  r:[^ A-Z0-9]||[ A-Z0-9]=* r:|=*' - \
-            "$_color_cache[@]"
+    compadd "$@" -M 'm:{a-z}={A-Z} m:-=\  r:[^ A-Z0-9]||[ A-Z0-9]=* r:|=*' -a \
+            _color_cache
Index: Completion/X/_x_cursor
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/_x_cursor,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 _x_cursor
--- Completion/X/_x_cursor	2000/03/23 04:19:32	1.1.1.4
+++ Completion/X/_x_cursor	2000/05/24 07:11:09
@@ -15,4 +15,4 @@
 fi
 
 _wanted cursors expl 'cursor name' \
-    compadd "$@" -M 'm:-=_ r:|_=*' - "$_cursor_cache[@]"
+    compadd "$@" -M 'm:-=_ r:|_=*' -a _cursor_cache
Index: Completion/X/_x_extension
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/_x_extension,v
retrieving revision 1.3
diff -u -r1.3 _x_extension
--- Completion/X/_x_extension	2000/04/11 07:57:57	1.3
+++ Completion/X/_x_extension	2000/05/24 07:11:09
@@ -15,5 +15,5 @@
   [[ "$1" = - ]] && shift
 
   _wanted extensions expl 'X extensions' \
-      compadd "$@" -M 'm:{a-z}={A-Z} r:|-=* r:|=*' - "$_xe_cache[@]"
+      compadd "$@" -M 'm:{a-z}={A-Z} r:|-=* r:|=*' - _xe_cache
 fi
Index: Completion/X/_x_font
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/_x_font,v
retrieving revision 1.3
diff -u -r1.3 _x_font
--- Completion/X/_x_font	2000/04/11 07:57:57	1.3
+++ Completion/X/_x_font	2000/05/24 07:11:09
@@ -13,4 +13,4 @@
 fi
 
 _wanted fonts expl font \
-    compadd -M 'r:|-=* r:|=*' "$@" -S '' - "$_font_cache[@]"
+    compadd -M 'r:|-=* r:|=*' "$@" -S '' -a _font_cache
Index: Completion/X/_x_keysym
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/_x_keysym,v
retrieving revision 1.3
diff -u -r1.3 _x_keysym
--- Completion/X/_x_keysym	2000/04/11 07:57:57	1.3
+++ Completion/X/_x_keysym	2000/05/24 07:11:09
@@ -19,4 +19,4 @@
 fi
 
 _wanted keysyms expl 'key symbol' \
-    compadd "$@" -M 'm:{a-z}={A-Z} r:|-=* r:|=*' - $_keysym_cache
+    compadd "$@" -M 'm:{a-z}={A-Z} r:|-=* r:|=*' -a _keysym_cache
Index: Completion/X/_xutils
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/_xutils,v
retrieving revision 1.6
diff -u -r1.6 _xutils
--- Completion/X/_xutils	2000/05/19 08:26:59	1.6
+++ Completion/X/_xutils	2000/05/24 07:11:09
@@ -73,7 +73,7 @@
       _tags displays
       while _tags; do
         while _next_label displays expl 'disallow access'; do
-	  { compadd "$expl[@]" -M 'm:{a-z}={A-Z} r:|[:.]=* r:|=*' - $tmp ||
+	  { compadd "$expl[@]" -M 'm:{a-z}={A-Z} r:|[:.]=* r:|=*' -a tmp ||
             _hosts "$expl[@]" } && ret=0
         done
 	(( ret )) || return 0

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


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

* Re: PATCH: Re: complete (real C) tags
  2000-05-23 14:19 Sven Wischnowsky
@ 2000-05-23 15:13 ` Peter Stephenson
  0 siblings, 0 replies; 11+ messages in thread
From: Peter Stephenson @ 2000-05-23 15:13 UTC (permalink / raw)
  To: Zsh hackers list

> This adds -a to make the words be used as names of arrays
> (actually I used get_user_var(), so '(foo bar)' is possible, should we 
> document this?) and complete their values. It also adds -k to make the 
> words be taken as names of assocs and complete their keys.

That's a huge improvement.  Here is _complete_tag.

Index: Completion/Commands/.distfiles
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Commands/.distfiles,v
retrieving revision 1.2
diff -u -r1.2 .distfiles
--- Completion/Commands/.distfiles	2000/04/30 21:04:54	1.2
+++ Completion/Commands/.distfiles	2000/05/23 15:11:24
@@ -2,5 +2,5 @@
     .distfiles
     _bash_completions _complete_debug _correct_filename _correct_word
     _expand_word _history_complete_word _read_comp _most_recent_file
-    _complete_help _next_tags
+    _complete_help _next_tags _complete_tag
 '
Index: Completion/Commands/_complete_tag
===================================================================
RCS file: _complete_tag
diff -N _complete_tag
--- /dev/null	Tue May  5 13:32:27 1998
+++ _complete_tag	Tue May 23 08:11:24 2000
@@ -0,0 +1,57 @@
+#compdef -k complete-word \C-xt
+
+# Complete tags using either TAGS or tags.  Looks up your directory
+# hierarchy to find one.  If both exist, uses TAGS.
+#
+# You can override the choice of tags file with $TAGSFILE (for TAGS)
+# or $tagsfile (for tags).
+#
+# Could be rewritten by some sed expert to use sed instead of perl.
+
+emulate -L zsh
+
+# Tags file to look for
+local c_Tagsfile=${TAGSFILE:-TAGS} c_tagsfile=${tagsfile:-tags} expl
+# Max no. of directories to scan up through
+integer c_maxdir=10
+# Context.
+local curcontext="$curcontext"
+local -a c_tags_array
+
+if [[ -z "$curcontext" ]]; then
+  curcontext="complete-tag:::"
+else
+  curcontext="complete-tag:${curcontext#*:}"
+fi
+
+local c_path=
+integer c_idir
+while [[ ! -f $c_path$c_Tagsfile &&
+         ! -f $c_path$c_tagsfile && $c_idir -lt $c_maxdir ]]; do
+  (( c_idir++ ))
+  c_path=../$c_path
+done
+
+if [[ -f $c_path$c_Tagsfile ]]; then
+  # prefer the more comprehensive TAGS, which unfortunately is a
+  # little harder to parse.
+  # could do this with sed, just can't be bothered to work out how,
+  # after quarter of an hour of trying, except for
+  #  rm -f =sed; ln -s /usr/local/bin/perl /usr/bin/sed
+  # but that's widely regarded as cheating.
+  c_tags_array=($(sed -n \
+        -e 's/^\(.*[a-zA-Z_0-9]\)[[ '$'\t'':;,()]*'$'\177''.*$/\1/' \
+        -e 's/^.*[^a-zA-Z_0-9]//' \
+        -e '/^[a-zA-Z_].*/p' $c_path$c_Tagsfile))
+#  c_tags_array=($(perl -ne '/([a-zA-Z_0-9]+)[ \t:;,\(]*\x7f/ &&
+#                  print "$1\n"' $c_path$c_Tagsfile))
+  _main_complete - '' _wanted etags expl 'emacs tags' \
+      compadd -a c_tags_array
+elif [[ -f $c_tagspath ]]; then
+  # tags doesn't have as much in, but the tag is easy to find.
+  # we can use awk here.
+  c_tags_array=($(awk '{ print $1 }' $c_path$c_Tagsfile))
+  _main_complete - '' _wanted vtags expl 'vi tags' compadd -a c_tags_array
+else
+  return 1
+fi
Index: Doc/Zsh/compsys.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.53
diff -u -r1.53 compsys.yo
--- Doc/Zsh/compsys.yo	2000/05/22 09:28:35	1.53
+++ Doc/Zsh/compsys.yo	2000/05/23 15:11:24
@@ -2460,6 +2460,18 @@
 completion attempt gets its own file.  A command to view each of these
 files is pushed onto the editor buffer stack.
 )
+findex(_complete_tag (^Xt))
+item(tt(_complete_tag (^Xt)))(
+This widget completes symbol tags created by the tt(etags) or tt(ctags)
+programmes (note there is no connection with the completion system's tags)
+stored in a file tt(TAGS), in the format used by tt(etags), or tt(tags), in the
+format created by tt(ctags).  It will look back up the path hierarchy for
+the first occurrence of either file; if both exist, the file tt(TAGS) is
+preferred.  You can specify the full path to a tt(TAGS) or tt(tags) file by
+setting the parameter tt($TAGSFILE) or tt($tagsfile) respectively.
+The corresponding completion tags used are tt(etags) and tt(vtags), after
+emacs and vi respectively.
+)
 enditem()
 
 texinode(Completion Functions)(Completion Directories)(Bindable Commands)(Completion System)

-- 
Peter Stephenson <pws@cambridgesiliconradio.com>
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


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

* PATCH: Re: complete (real C) tags
@ 2000-05-23 14:19 Sven Wischnowsky
  2000-05-23 15:13 ` Peter Stephenson
  0 siblings, 1 reply; 11+ messages in thread
From: Sven Wischnowsky @ 2000-05-23 14:19 UTC (permalink / raw)
  To: zsh-workers


Peter Stephenson wrote:

> Sven wrote:
> >   Actually, I've been tempted from the beginning to allow compadd to
> >   get the matches not only from its positional parameters, but also
> >   from arrays whose names are given as arguments. That would allow us
> >   to stuff the matches into some array and then call:
> > 
> >     foo=(...)
> >     _wanted ... compadd -a foo
> > 
> >   or some such.
> 
> This sounds a simple and effective solution.  I presume it could be done
> with minimal changes --- just modify compadd argument handling and then
> pass down the argument `-a carefully_chosen_parameter_name' (so as no to
> clash with any parameters in the middle).

Exactly. This adds -a to make the words be used as names of arrays
(actually I used get_user_var(), so '(foo bar)' is possible, should we 
document this?) and complete their values. It also adds -k to make the 
words be taken as names of assocs and complete their keys.

It's small and easily separatable enough to make me commit it when
this mail comes back. So, if anyone has objections (to -k or to both
options), I can take them out again. Partly because of this I also
haven't changed any completion functions yet, but there are several
functions that could be made faster with this...

Bye
 Sven

Index: Doc/Zsh/compwid.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compwid.yo,v
retrieving revision 1.15
diff -u -r1.15 compwid.yo
--- Doc/Zsh/compwid.yo	2000/05/22 11:28:29	1.15
+++ Doc/Zsh/compwid.yo	2000/05/23 14:15:19
@@ -415,7 +415,7 @@
 startitem()
 findex(compadd)
 cindex(completion widgets, adding specified matches)
-xitem(tt(compadd) [ tt(-qQfenUal12) ] [ tt(-F) var(array) ])
+xitem(tt(compadd) [ tt(-akqQfenUl12) ] [ tt(-F) var(array) ])
 xitem([ tt(-P) var(prefix) ] [ tt(-S) var(suffix) ])
 xitem([ tt(-p) var(hidden-prefix) ] [ tt(-s) var(hidden-suffix) ])
 xitem([ tt(-i) var(ignored-prefix) ] [ tt(-I) var(ignored-suffix) ])
@@ -479,6 +479,14 @@
 )
 item(tt(-I) var(ignored-suffix))(
 Like tt(-i), but gives an ignored suffix.
+)
+item(tt(-a))(
+With this flag the var(words) are taken as names of arrays and the
+possible matches are their values.
+)
+item(tt(-k))(
+With this flag the var(words) are taken as names of associative arrays
+and the possible matches are their keys.
 )
 item(tt(-d) var(array))(
 This adds per-match display strings. The var(array) should contain one 
Index: Src/params.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/params.c,v
retrieving revision 1.10
diff -u -r1.10 params.c
--- Src/params.c	2000/05/19 18:22:51	1.10
+++ Src/params.c	2000/05/23 14:15:20
@@ -1741,6 +1741,21 @@
     return NULL;
 }
 
+/* Retrieve the keys of an assoc array parameter as an array */
+
+/**/
+mod_export char **
+gethkparam(char *s)
+{
+    struct value vbuf;
+    Value v;
+
+    if (!idigit(*s) && (v = getvalue(&vbuf, &s, 0)) &&
+	PM_TYPE(v->pm->flags) == PM_HASHED)
+	return paramvalarr(v->pm->gets.hfn(v->pm), SCANPM_WANTKEYS);
+    return NULL;
+}
+
 /**/
 mod_export Param
 setsparam(char *s, char *val)
Index: Src/Zle/comp.h
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/comp.h,v
retrieving revision 1.5
diff -u -r1.5 comp.h
--- Src/Zle/comp.h	2000/05/17 11:59:33	1.5
+++ Src/Zle/comp.h	2000/05/23 14:15:20
@@ -233,6 +233,8 @@
 #define CAF_MATCH    4
 #define CAF_UNIQCON  8
 #define CAF_UNIQALL 16
+#define CAF_ARRAYS  32
+#define CAF_KEYS    64
 
 /* Data for compadd and addmatches() */
 
Index: Src/Zle/compcore.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compcore.c,v
retrieving revision 1.23
diff -u -r1.23 compcore.c
--- Src/Zle/compcore.c	2000/05/22 11:28:29	1.23
+++ Src/Zle/compcore.c	2000/05/23 14:15:21
@@ -1538,6 +1538,17 @@
     }
 }
 
+static char **
+get_user_keys(char *nam)
+{
+    char **ret;
+
+    if ((ret = gethkparam(nam)))
+	return (incompfunc ? arrdup(ret) : ret);
+
+    return NULL;
+}
+
 /* This is used by compadd to add a couple of matches. The arguments are
  * the strings given via options. The last argument is the array with
  * the matches. */
@@ -1549,8 +1560,9 @@
     char *s, *ms, *lipre = NULL, *lisuf = NULL, *lpre = NULL, *lsuf = NULL;
     char **aign = NULL, **dparr = NULL, *oaq = autoq, *oppre = dat->ppre;
     char *oqp = qipre, *oqs = qisuf, qc, **disp = NULL, *ibuf = NULL;
+    char **arrays = NULL;
     int lpl, lsl, pl, sl, bcp = 0, bcs = 0, bpadd = 0, bsadd = 0;
-    int ppl = 0, psl = 0;
+    int ppl = 0, psl = 0, ilen = 0;
     int llpl = 0, llsl = 0, nm = mnum, gflags = 0, ohp = haspattern;
     int isexact, doadd, ois = instring, oib = inbackt;
     Cline lc = NULL, pline = NULL, sline = NULL;
@@ -1855,16 +1867,18 @@
 	/* Walk through the matches given. */
 	obpl = bpl;
 	obsl = bsl;
-	if (aign || pign) {
-	    int max = 0;
-	    char **ap = argv;
-
-	    ppl = (dat->ppre ? strlen(dat->ppre) : 0);
-	    while ((s = *ap++))
-		if ((sl = strlen(s)) > max)
-		    max = sl;
-	    psl = (dat->psuf ? strlen(dat->psuf) : 0);
-	    ibuf = (char *) zhalloc(1 + ppl + max + psl);
+	if (dat->aflags & CAF_ARRAYS) {
+	    arrays = argv;
+	    argv = NULL;
+	    while (*arrays && (!(argv = ((dat->aflags & CAF_KEYS) ?
+					 get_user_keys(*arrays) :
+					 get_user_var(*arrays))) || !*argv))
+		arrays++;
+	    arrays++;
+	    if (!argv) {
+		ms = NULL;
+		argv = &ms;
+	    }
 	}
 	for (; (s = *argv); argv++) {
 	    bpl = obpl;
@@ -1877,6 +1891,9 @@
 	    if (aign || pign) {
 		int il = ppl + sl + psl, addit = 1;
 
+		if (il > ilen)
+		    ibuf = (char *) zhalloc((ilen = il) + 1);
+
 		if (ppl)
 		    memcpy(ibuf, dat->ppre, ppl);
 		strcpy(ibuf + ppl, s);
@@ -1952,6 +1969,19 @@
 			dparr = NULL;
 		}
 		free_cline(lc);
+	    }
+	    if ((dat->aflags & CAF_ARRAYS) && !argv[1]) {
+		argv = NULL;
+		while (*arrays && (!(argv = ((dat->aflags & CAF_KEYS) ?
+					     get_user_keys(*arrays) :
+					     get_user_var(*arrays))) || !*argv))
+		    arrays++;
+		arrays++;
+		if (!argv) {
+		    ms = NULL;
+		    argv = &ms;
+		}
+		argv--;
 	    }
 	}
 	if (dat->apar)
Index: Src/Zle/complete.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/complete.c,v
retrieving revision 1.7
diff -u -r1.7 complete.c
--- Src/Zle/complete.c	2000/05/02 10:31:11	1.7
+++ Src/Zle/complete.c	2000/05/23 14:15:21
@@ -442,6 +442,12 @@
 	    case 'e':
 		dat.flags |= CMF_ISPAR;
 		break;
+	    case 'a':
+		dat.aflags |= CAF_ARRAYS;
+		break;
+	    case 'k':
+		dat.aflags |= CAF_ARRAYS|CAF_KEYS;
+		break;
 	    case 'F':
 		sp = &(dat.ign);
 		e = "string expected after -%c";

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


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

* PATCH: Re: complete (real C) tags
@ 2000-05-18 10:46 Sven Wischnowsky
  0 siblings, 0 replies; 11+ messages in thread
From: Sven Wischnowsky @ 2000-05-18 10:46 UTC (permalink / raw)
  To: zsh-workers


Peter Stephenson wrote:

> I don't think I ever posted this; it allows the new completion system to
> complete tags from a TAGS or tags file (i.e. the tags used by Emacs and vi,
> nothing to do with completion tags).  I have it bound to ^Xt.
> 
> I was going to send it to zshu, until I realised it didn't use style tags,
> and tried to make it by sticking the _wanted stuff in front, which failed,
> so I took it off again.  Only one man will know why...

This showed a problem with _wanted and friends: they need some setup
done by _main_complete. But one way of fixing this gives a nice
enhancement to _main_complete, as in the patch below. If it is called
with arguments and the first one is a `-', then the second one is
taken as a name to stuff into the completer field of the context and
the other arguments give a command with its arguments to call to
generate the matches. So, this would be the patch to _complete_tag
(not committed because there is no _complete_tag yet):

--- _complete_tag.old	Thu May 18 11:54:39 2000
+++ _complete_tag	Thu May 18 12:26:26 2000
@@ -14,6 +14,14 @@
 local c_Tagsfile=${TAGSFILE:-TAGS} c_tagsfile=${tagsfile:-tags} expl
 # Max no. of directories to scan up through
 integer c_maxdir=10
+# Context.
+local curcontext="$curcontext"
+
+if [[ -z "$curcontext" ]]; then
+  curcontext="complete-tag:::"
+else
+  curcontext="complete-tag:${curcontext#*:}"
+fi
 
 local c_path=
 integer c_idir
@@ -30,16 +38,16 @@
   # after quarter of an hour of trying, except for
   #  rm -f =sed; ln -s /usr/local/bin/perl /usr/bin/sed
   # but that's widely regarded as cheating.
-  # _wanted etags expl 'emacs tags'
-  compadd - \
-    $(perl -ne '/([a-zA-Z_0-9]+)[ \t:;,\(]*\x7f/ &&
-	    print "$1\n"' $c_path$c_Tagsfile)
+  _main_complete - '' _wanted etags expl 'emacs tags' \
+      compadd - \
+        $(perl -ne '/([a-zA-Z_0-9]+)[ \t:;,\(]*\x7f/ &&
+	            print "$1\n"' $c_path$c_Tagsfile)
 elif [[ -f $c_tagspath ]]; then
   # tags doesn't have as much in, but the tag is easy to find.
   # we can use awk here.
-  # _wanted vtags expl 'vi tags'
-  compadd - \
-    $(awk '{ print $1 }' $c_path$c_Tagsfile)
+  _main_complete - '' _wanted vtags expl 'vi tags' \
+      compadd - \
+        $(awk '{ print $1 }' $c_path$c_Tagsfile)
 else
   return 1
 fi


And here is the patch for the change to _main_complete...

Bye
 Sven

Index: Completion/Core/_main_complete
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_main_complete,v
retrieving revision 1.20
diff -u -r1.20 _main_complete
--- Completion/Core/_main_complete	2000/05/17 06:50:03	1.20
+++ Completion/Core/_main_complete	2000/05/18 10:46:21
@@ -20,7 +20,7 @@
 unsetopt markdirs globsubst shwordsplit nounset ksharrays
 exec </dev/null	# ZLE closes stdin, which can cause errors
 
-local func funcs ret=1 tmp _compskip format nm \
+local func funcs ret=1 tmp _compskip format nm call \
       _completers _completer _completer_num curtag _comp_force_list \
       _matchers _matcher _matcher_num _comp_tags _comp_mesg \
       context state line opt_args val_args curcontext="$curcontext" \
@@ -84,7 +84,16 @@
 # Get the names of the completers to use in the positional parameters.
 
 if (( $# )); then
-  _completers=( "$@" )
+  if [[ "$1" = - ]]; then
+    if [[ $# -lt 3 ]]; then
+      _completers=()
+    else
+      _completers=( "$2" )
+      call=yes
+    fi
+  else
+    _completers=( "$@" )
+  fi
 else
   zstyle -a ":completion:${curcontext}:" completer _completers ||
       _completers=( _complete _ignored )
@@ -104,7 +113,9 @@
 
 for tmp in "$_completers[@]"; do
 
-  if [[ "$tmp" = *:-* ]]; then
+  if [[ -n "$call" ]]; then
+    _completer="${tmp}"
+  elif [[ "$tmp" = *:-* ]]; then
     _completer="${${tmp%:*}[2,-1]//_/-}${tmp#*:}"
     tmp="${tmp%:*}"
   elif [[ $tmp = *:* ]]; then
@@ -120,7 +131,12 @@
 
   _matcher_num=1
   for _matcher in "$_matchers[@]"; do
-    if "$tmp"; then
+    if [[ -n "$call" ]]; then
+      if "${(@)argv[3,-1]}"; then
+        ret=0
+        break 2
+      fi
+    elif "$tmp"; then
       ret=0
       break 2
     fi
Index: Doc/Zsh/compsys.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.50
diff -u -r1.50 compsys.yo
--- Doc/Zsh/compsys.yo	2000/05/18 09:22:31	1.50
+++ Doc/Zsh/compsys.yo	2000/05/18 10:46:22
@@ -2003,6 +2003,12 @@
 value is zero, no other completers are tried and the tt(_main_complete)
 function returns.
 
+If the first argument to tt(_main_complete) is a single hyphen, the
+arguments will not be taken as names of completers. Instead, the
+second argument gives a name to use in the var(completer) field of the 
+context and the other arguments give a command anme and arguments to
+call to generate the matches.
+
 The following completer functions are contained in the distribution (users
 may write their own):
 

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


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

end of thread, other threads:[~2000-05-31 10:07 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-31  9:36 PATCH: Re: complete (real C) tags Sven Wischnowsky
2000-05-31 10:07 ` Peter Stephenson
  -- strict thread matches above, loose matches on Subject: below --
2000-05-25 12:18 Sven Wischnowsky
2000-05-25 13:02 ` Thomas Köhler
2000-05-25 14:41 ` Bart Schaefer
2000-05-24  8:00 Sven Wischnowsky
2000-05-24  9:00 ` Peter Stephenson
2000-05-24  9:09   ` Thomas Köhler
2000-05-23 14:19 Sven Wischnowsky
2000-05-23 15:13 ` Peter Stephenson
2000-05-18 10:46 Sven Wischnowsky

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