From: "Bart Schaefer" <schaefer@candle.brasslantern.com>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: Problem with _expand, _path_files, and $(command)
Date: Sun, 2 Jul 2000 17:13:54 +0000 [thread overview]
Message-ID: <1000702171355.ZM11193@candle.brasslantern.com> (raw)
The first problem is that the stderr of the command messes up the display.
Then if the command doesn't produce any output, assorted bad things happen
at line 80 of _expand:
zagzig[120] echo $(stty -a)stty: standard input: Inappropriate ioctl for device
_expand:80: unknown file attribute
zagzig[121] echo $(exit 0)
_expand:80: missing end of string
Both of those examples break _complete_debug, because they're treated as
fatal errors (just like the problem we were having with ${(e)garbage} a
while ago).
If I remove _expand from the completer style, I get this:
zagzig[86] echo $(exit 0)
_path_files:325: missing end of string
After the patch below, there's still a problem with _path_files, because
the parens in $(exit 0) are interpreted as enclosing a glob qualifier, so
something else goes haywire:
zagzig[88] echo $(exit 0)
zagzig[88] echo \$\*\(exit\ 0Om\)
Of course the best thing to do at lines 64-66 of _expand, would be to
capture the standard error of the $(...) and use `_message -r' to display
it. However, I can't think of any way to capture stderr that wouldn't
cause the entire exp=(...) to be forced into a subshell, except by using
a temp file, which is unacceptable overhead in the "normal" case.
--- zsh-forge/current/Completion/Core/_expand Thu Jun 29 01:32:02 2000
+++ zsh-3.1.9/Completion/Core/_expand Sun Jul 2 09:35:37 2000
@@ -63,7 +63,7 @@
eval exp\=\( ${${(q)exp}:gs/\\{/\{/:gs/\\}/\}/} \)
exp=( ${${(e)exp//\\[
]/ }//(#b)([
-])/\\$match[1]} )
+])/\\$match[1]} ) 2>/dev/null
else
exp=( ${exp:s/\\\$/\$} )
fi
@@ -77,7 +77,7 @@
# Now try globbing.
[[ "$force" = *g* ]] || zstyle -T ":completion:${curcontext}:" glob &&
- exp=( ${~exp} )
+ eval 'exp=( ${~exp} )' 2>/dev/null
# If we don't have any expansions or only one and that is the same
# as the original string, we let other completers run.
--- zsh-forge/current/Completion/Core/_path_files Mon Jun 19 09:47:27 2000
+++ zsh-3.1.9/Completion/Core/_path_files Sun Jul 2 09:29:39 2000
@@ -322,7 +322,7 @@
else
compfiles -p$cfopt tmp1 accex "$skipped" "$_matcher" '' fake "$pats[@]"
fi
- tmp1=( $~tmp1 )
+ eval 'tmp1=( $~tmp1 )' 2>/dev/null
if [[ -n "$PREFIX$SUFFIX" ]]; then
# See which of them match what's on the line.
--
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 reply other threads:[~2000-07-02 17:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-07-02 17:13 Bart Schaefer [this message]
2000-07-03 8:12 Sven Wischnowsky
2000-07-03 8:51 ` Bart Schaefer
2000-07-03 9:01 Sven Wischnowsky
2000-07-03 17:30 ` Bart Schaefer
2000-07-04 8:04 Sven Wischnowsky
2000-07-04 17:15 ` Bart Schaefer
2000-07-05 6:26 Sven Wischnowsky
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=1000702171355.ZM11193@candle.brasslantern.com \
--to=schaefer@candle.brasslantern.com \
--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).