From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.dk
Subject: Re: Another keep-prefix problem
Date: Wed, 25 Apr 2001 15:25:52 +0200 (MET DST) [thread overview]
Message-ID: <200104251325.PAA03945@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: <Pine.LNX.4.30.0104241130360.3333-100000@phong.blorf.net>
[ We only just found out that my machine still had the address of that
server that died yesterday in it's resolv.conf... that was the reason
why I didn't get my mails back -- they weren't sent. Apologies to the
folks at sunsite. Ahem. ]
Wayne Davison wrote:
> ...
>
> % ls -l /net/machine$path/foo<TAB>
>
> This does not expand anything. I think that it will cause less
> confusion if the new expander would work like the old one does in
> this regard.
>
> However, I have the same complaint about keep-prefix when using
> wildcards:
>
> % ls -l /net/machine$path/foo*<TAB>
>
> I'd like to see $path left unexpanded. In other words, I want keep-
> prefix to preserve the prefix no matter where the $ expression is in
> the prefix.
Please try the patch below and tell me what you think (and everyone else
interested in this subject, too, please). It gives me what you want for
both cases.
I won't commit this before I get positive replies and answers to the
question if we then should add another possible value for the
keep-prefix style for this new behaviour or if that's not needed (I
can't really think of a reason for keeping the old behaviour -- put some
people probably like it?).
Bye
Sven
Index: Completion/Base/Completer/_expand
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Completer/_expand,v
retrieving revision 1.1
diff -u -r1.1 _expand
--- Completion/Base/Completer/_expand 2001/04/02 11:06:35 1.1
+++ Completion/Base/Completer/_expand 2001/04/25 13:20:37
@@ -89,10 +89,16 @@
[[ "$subd" = "$exp"(|\(N\)) ]] && return 1
zstyle -s ":completion:${curcontext}:" keep-prefix tmp || tmp=changed
-if [[ "$word" = [\~\$]*/* && "$tmp" = (yes|true|on|1|changed) ]]; then
- eval 'epre=( ${(e)~${word%%/*}} )' 2>/dev/null
- if [[ -n "$epre" && $#epre -eq 1 ]]; then
+
+if [[ "$word" = (\~*/*|*\$*/*) && "$tmp" = (yes|true|on|1|changed) ]]; then
+ if [[ "$word" = *\$* ]]; then
+ opre="${(M)word##*\$[^/]##/}"
+ else
opre="${word%%/*}"
+ fi
+ eval 'epre=( ${(e)~opre} )' 2> /dev/null
+
+ if [[ -n "$epre" && $#epre -eq 1 ]]; then
pre="${(q)epre[1]}"
[[ "$tmp" != changed || $#exp -gt 1 ||
"${opre}${exp[1]#${pre}}" != "$word" ]] && exp=( ${opre}${^exp#${pre}} )
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next prev parent reply other threads:[~2001-04-25 13:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-04-24 0:46 Wayne Davison
2001-04-24 16:50 ` Bart Schaefer
2001-04-24 19:18 ` Wayne Davison
2001-04-25 13:25 ` Sven Wischnowsky [this message]
2001-04-26 4:33 ` Bart Schaefer
2001-04-26 14:27 Oliver Kiddle
2001-04-26 15:43 ` Wayne Davison
2001-04-26 17:18 ` Bart Schaefer
2001-04-26 23:38 ` Wayne Davison
2001-04-27 9:03 ` 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=200104251325.PAA03945@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@sunsite.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).