From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14035 invoked from network); 4 Jul 2000 17:16:14 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 4 Jul 2000 17:16:14 -0000 Received: (qmail 24810 invoked by alias); 4 Jul 2000 17:16:06 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 12162 Received: (qmail 24789 invoked from network); 4 Jul 2000 17:16:03 -0000 From: "Bart Schaefer" Message-Id: <1000704171552.ZM21336@candle.brasslantern.com> Date: Tue, 4 Jul 2000 17:15:51 +0000 In-Reply-To: <200007040804.KAA07882@beta.informatik.hu-berlin.de> Comments: In reply to Sven Wischnowsky "Re: PATCH: Problem with _expand, _path_files, and $(command)" (Jul 4, 10:04am) References: <200007040804.KAA07882@beta.informatik.hu-berlin.de> X-Mailer: Z-Mail (5.0.0 30July97) To: Sven Wischnowsky , zsh-workers@sunsite.auc.dk Subject: Re: PATCH: Problem with _expand, _path_files, and $(command) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Jul 4, 10:04am, Sven Wischnowsky wrote: } Subject: Re: PATCH: Problem with _expand, _path_files, and $(command) } } Is the eval in line 324 [of _path_files] still needed? It appears not. } I found another one: completion after something like `../$[4+]/' [...] } Blah. Very ugly. For now I had to add some $(print...)s, does anyone } see a better solution? Yes: Use `eval'. `$(print -r ...)' won't do the right thing in the array context, will it? For file names with embedded spaces, etc.? The one remaining problem is that zwarn() calls trashzle() even when stderr has been redirected away from the terminal. Does anyone see a problem with the utils.c patch below? Index: Completion/Core/_expand =================================================================== @@ -61,9 +61,9 @@ zstyle -T ":completion:${curcontext}:" substitute; then [[ ! -o ignorebraces && "${#${exp}//[^\{]}" = "${#${exp}//[^\}]}" ]] && eval exp\=\( ${${(q)exp}:gs/\\{/\{/:gs/\\}/\}/} \) - exp=( $(print -r ${${(e)exp//\\[ + eval 'exp=( ${${(e)exp//\\[ ]/ }//(#b)([ -])/\\$match[1]}) ) 2>/dev/null +])/\\$match[1]} )' 2>/dev/null else exp=( ${exp:s/\\\$/\$} ) fi @@ -95,7 +95,7 @@ zstyle -s ":completion:${curcontext}:" keep-prefix tmp || tmp=changed if [[ "$word" = [\~\$]*/* && "$tmp" = (yes|true|on|1|changed) ]]; then - epre=( $(print -r ${(e)~${word%%/*}}) ) 2>/dev/null + eval 'epre=( ${(e)~${word%%/*}} )' 2>/dev/null if [[ -n "$epre" && $#epre -eq 1 ]]; then opre="${word%%/*}" pre="$epre[1]" Index: Completion/Core/_path_files =================================================================== @@ -247,9 +247,10 @@ # after the first slash after the parameter expansion. # This fails for things like `f/$foo/b/' where the first `f' is # meant as a partial path. + linepath="${(M)pre##*\$[^/]##/}" - realpath=$(print -r ${(e)~linepath}) 2>/dev/null - [[ -z "$realpath" || "$realpath" = "$linepath" ]] && return 1 + eval 'realpath=${(e)~linepath}' 2>/dev/null + [[ -z "$realpath" || "$realpath" = "$linepath" ]] && return 1 pre="${pre#${linepath}}" i="${#linepath//[^\\/]}" orig="${orig[1,(in:i:)/][1,-2]}" @@ -321,7 +322,7 @@ else compfiles -p$cfopt tmp1 accex "$skipped" "$_matcher" '' fake "$pats[@]" fi - eval 'tmp1=( $~tmp1 )' 2>/dev/null + tmp1=( $~tmp1 ) if [[ -n "$PREFIX$SUFFIX" ]]; then # See which of them match what's on the line. Index: Src/utils.c =================================================================== @@ -67,7 +67,8 @@ { if (errflag || noerrs) return; - trashzle(); + if (isatty(2)) + trashzle(); /* * scriptname is set when sourcing scripts, so that we get the * correct name instead of the generic name of whatever -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net