From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>,
zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: Problem with _expand, _path_files, and $(command)
Date: Tue, 4 Jul 2000 17:15:51 +0000 [thread overview]
Message-ID: <1000704171552.ZM21336@candle.brasslantern.com> (raw)
In-Reply-To: <200007040804.KAA07882@beta.informatik.hu-berlin.de>
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
next prev parent reply other threads:[~2000-07-04 17:16 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-07-04 8:04 Sven Wischnowsky
2000-07-04 17:15 ` Bart Schaefer [this message]
-- strict thread matches above, loose matches on Subject: below --
2000-07-05 6:26 Sven Wischnowsky
2000-07-03 9:01 Sven Wischnowsky
2000-07-03 17:30 ` Bart Schaefer
2000-07-03 8:12 Sven Wischnowsky
2000-07-03 8:51 ` Bart Schaefer
2000-07-02 17:13 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=1000704171552.ZM21336@candle.brasslantern.com \
--to=schaefer@candle.brasslantern.com \
--cc=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).