Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: Problem with _expand, _path_files, and $(command)
- X-seq: zsh-workers 12162
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>, zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: PATCH: Problem with _expand, _path_files, and $(command)
- Date: Tue, 4 Jul 2000 17:15:51 +0000
- In-reply-to: <200007040804.KAA07882@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <200007040804.KAA07882@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
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/<TAB>' 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author