From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13792 invoked from network); 23 May 2000 08:54:03 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 23 May 2000 08:54:03 -0000 Received: (qmail 10831 invoked by alias); 23 May 2000 08:52:40 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11525 Received: (qmail 10773 invoked from network); 23 May 2000 08:52:31 -0000 Date: Tue, 23 May 2000 10:51:05 +0200 (MET DST) Message-Id: <200005230851.KAA23597@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Oliver Kiddle's message of Mon, 22 May 2000 19:12:34 +0100 Subject: Re: PATCH: _next_label losing empty arguments 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