zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: _next_label losing empty arguments
Date: Tue, 23 May 2000 10:51:05 +0200 (MET DST)	[thread overview]
Message-ID: <200005230851.KAA23597@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Oliver Kiddle's message of Mon, 22 May 2000 19:12:34 +0100


Oliver Kiddle wrote:

> Firstly, thanks Bart for the _arguments fix - that solved my problem.

Yes, thanks, Bart. My fault...

> ...
> 
> Is the use of set in this patch instead of eval safe? [...]

Blink. I had completely forgotten about `set -A'. Cute. Faster and
much more readable. Let's use it in other places, too.

(Oliver, I also changed your changes to use ${(@)argv[...]} instead of 
${argv[...][@]}, mostly for consistency with other places, but I think 
it should also be a tad faster. Haven't measured that, though.)

Bye
 Sven

Index: Completion/Base/_arguments
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/_arguments,v
retrieving revision 1.21
diff -u -r1.21 _arguments
--- Completion/Base/_arguments	2000/05/22 17:18:05	1.21
+++ Completion/Base/_arguments	2000/05/23 08:51:40
@@ -149,7 +149,7 @@
 	cache=( "$cache[@]" "$tmp[@]" )
       fi
     done
-    eval "${name}=( \"\${(@)cache:# #}\" )"
+    set -A "$name" "${(@)cache:# #}"
   fi
   set -- "$tmpargv[@]" "${(@P)name}"
 fi
Index: Completion/Commands/_complete_help
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Commands/_complete_help,v
retrieving revision 1.7
diff -u -r1.7 _complete_help
--- Completion/Commands/_complete_help	2000/05/10 04:55:10	1.7
+++ Completion/Commands/_complete_help	2000/05/23 08:51:41
@@ -32,7 +32,7 @@
     # No need to call the completers more than once with different match specs.
 
     if [[ "$3" = matcher-list ]]; then
-      eval "${4}=( '' )"
+      set -A "$4" ''
     else
       builtin zstyle "$@"
     fi
Index: Completion/Commands/_next_tags
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Commands/_next_tags,v
retrieving revision 1.5
diff -u -r1.5 _next_tags
--- Completion/Commands/_next_tags	2000/04/11 07:57:56	1.5
+++ Completion/Commands/_next_tags	2000/05/23 08:51:41
@@ -62,10 +62,10 @@
         zformat -f descr "${curtag#*:}" "d:$3"
         _description "$gopt" "${curtag%:*}" "$2" "$descr"
         curtag="${curtag%:*}"
-        eval "${2}=( \${(P)2} \$argv[4,-1] )"
+	set -A "$2" "${(P@)2}" "${(@)argv[4,-1]}"
       else
         _description "$gopt" "$curtag" "$2" "$3"
-        eval "${2}=( \$argv[4,-1] \${(P)2} )"
+	set -A "$2" "${(@)argv[4,-1]}" "${(P@)2}"
       fi
 
       return 0
Index: Completion/Core/_description
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_description,v
retrieving revision 1.5
diff -u -r1.5 _description
--- Completion/Core/_description	2000/05/15 23:33:30	1.5
+++ Completion/Core/_description	2000/05/23 08:51:41
@@ -26,8 +26,8 @@
 zstyle -s ":completion:${curcontext}:$1" group-name gname &&
     [[ -z "$gname" ]] && gname="$1"
 zstyle -s ":completion:${curcontext}:$1" matcher match &&
-    opts=($opts -M "${(q)match}")
-[[ -n "$_matcher" ]] && opts=($opts -M "${(q)_matcher}")
+    opts=($opts -M "$match")
+[[ -n "$_matcher" ]] && opts=($opts -M "$_matcher")
 
 if [[ -z "$_comp_no_ignore" ]]; then
   if zstyle -a ":completion:${curcontext}:$1" ignored-patterns _comp_ignore; then
@@ -48,15 +48,15 @@
 
 if [[ -n "$gname" ]]; then
   if [[ -n "$format" ]]; then
-    eval "${name}=($opts $gropt ${(q)gname} -X \"${format}\")"
+    set -A "$name" "$opts[@]" "$gropt" "$gname" -X "$format"
   else
-    eval "${name}=($opts $gropt ${(q)gname})"
+    set -A "$name" "$opts[@]" "$gropt" "$gname"
   fi
 else
   if [[ -n "$format" ]]; then
-    eval "${name}=($opts $gropt -default- -X \"${format}\")"
+    set -A "$name" "$opts[@]" "$gropt" -default- -X "$format"
   else
-    eval "${name}=($opts $gropt -default-)"
+    set -A "$name" "$opts[@]" "$gropt" -default-
   fi
 fi
 
Index: Completion/Core/_next_label
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_next_label,v
retrieving revision 1.3
diff -u -r1.3 _next_label
--- Completion/Core/_next_label	2000/05/22 18:15:54	1.3
+++ Completion/Core/_next_label	2000/05/23 08:51:41
@@ -13,10 +13,10 @@
     zformat -f descr "${curtag#*:}" "d:$3"
     _description "$gopt" "${curtag%:*}" "$2" "$descr"
     curtag="${curtag%:*}"
-    set -A $2 "${(P@)2}" "${argv[4,-1][@]}"
+    set -A $2 "${(P@)2}" "${(@)argv[4,-1]}"
   else
     _description "$gopt" "$curtag" "$2" "$3"
-    set -A $2 "${argv[4,-1][@]}" "${(P@)2}"
+    set -A $2 "${(@)argv[4,-1]}" "${(P@)2}"
   fi
 
   return 0

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


             reply	other threads:[~2000-05-23  8:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-23  8:51 Sven Wischnowsky [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-05-22 18:12 Oliver Kiddle
2000-05-22 18:33 ` 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=200005230851.KAA23597@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --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).