about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2000-07-26 09:16:13 +0000
committerBart Schaefer <barts@users.sourceforge.net>2000-07-26 09:16:13 +0000
commitf303f2ea63ce70f63355349bc0130ddb04a251f8 (patch)
treedca8a07660778e388919abad3ba54a6dffd4d3e1
parent04aaf1cd7f9fb791a3f305c2d8f6e7f995b1db6a (diff)
downloadzsh-f303f2ea63ce70f63355349bc0130ddb04a251f8.tar.gz
zsh-f303f2ea63ce70f63355349bc0130ddb04a251f8.tar.xz
zsh-f303f2ea63ce70f63355349bc0130ddb04a251f8.zip
Belatedly fold in 12162, to replace command subst with eval.
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Core/_expand6
-rw-r--r--Completion/Core/_path_files7
-rw-r--r--Src/utils.c3
4 files changed, 14 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index a5001962a..8e2683973 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,11 @@
 	Doc/Zsh/compsys.yo: Separate compinit security checks into their
 	own callable function.
 
+	* 12162: Completion/Core/_expand, Completion/Core/_path_files,
+	Src/utils.c: Use `eval' instead of `$(print ...)' to suppress
+	some syntax error failures; this requires that zwarn() does not
+	trashzle() when the output is not going to the terminal.
+	
 2000-07-26  Sven Wischnowsky  <wischnow@zsh.org>
 
 	* 12378: Completion/Base/_arguments: make `_arguments --' use
diff --git a/Completion/Core/_expand b/Completion/Core/_expand
index 4515a20a2..09d89a30b 100644
--- a/Completion/Core/_expand
+++ b/Completion/Core/_expand
@@ -61,9 +61,9 @@ if [[ "$force" = *s* ]] ||
    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 @@ subd=("$exp[@]")
 
 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]"
diff --git a/Completion/Core/_path_files b/Completion/Core/_path_files
index bf6049f8f..1e8059e4b 100644
--- a/Completion/Core/_path_files
+++ b/Completion/Core/_path_files
@@ -249,9 +249,10 @@ elif [[ "$pre" = *\$*/* && "$compstate[quote]" != \" ]]; then
   # 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]}"
@@ -323,7 +324,7 @@ for prepath in "$prepaths[@]"; do
     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.
diff --git a/Src/utils.c b/Src/utils.c
index 955158831..33fed62dd 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -67,7 +67,8 @@ zwarn(const char *fmt, const char *str, int num)
 {
     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