From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.dk
Subject: Re: Preserve initial // in path name completion
Date: Fri, 6 Jul 2001 11:24:04 +0200 (MET DST) [thread overview]
Message-ID: <200107060924.LAA12231@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: <003d01c105da$9a608230$21c9ca95@mow.siemens.ru>
Andrej Borsenkow wrote:
> Is it (easily) possible to preserve initial // irrespectively of
> squeez-slashes? (Or depending on other style)? Looks like zsh is gaining
> popularity on Cygwin and probably will be included in standard net release;
> having the above allows you finally complete inside network shares
> (fake-files //:'server1 server2' ...).
>
> Sven?
Currently not. Seems like we never came aroud to implementing it, but
it can be made quite simply, see the patch below. It adds a style
`preserve-prefix' which can be given a pattern and _path_files will then
blindly keep any prefix matched by that pattern unchanged.
Would that be enough? (Please try it by hand, I won't commit it until I
get positive replies -- but then I probably will because if I remember
correctly there were even Unices which attach a special meaning to a
leading `//' which in turn makes me wonder why we didn't add it earlier,
but maybe I just haven't been asked often enough or was too fed up at
those times...).
Maybe we should then rename it to `keep-prefix', but maybe not, because
it has a slightly differnet meaning in _expand (and different values).
Bye
Sven
Index: Completion/Unix/Type/_path_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_path_files,v
retrieving revision 1.6
diff -u -r1.6 _path_files
--- Completion/Unix/Type/_path_files 2001/06/18 09:53:17 1.6
+++ Completion/Unix/Type/_path_files 2001/07/06 09:21:25
@@ -264,7 +264,15 @@
linepath=
realpath=
- if [[ "$pre[1]" = / ]]; then
+ if zstyle -s ":completion:${curcontext}:" preserve-prefix tmp1 &&
+ [[ -n "$tmp1" && "$pre" = (#b)(${~tmp1})* ]]; then
+
+ pre="$pre[${#match[1]}+1,-1]"
+ orig="$orig[${#match[1]}+1,-1]"
+ donepath="$match[1]"
+ prepaths=( '' )
+
+ elif [[ "$pre[1]" = / ]]; then
# If it is a absolute path name, we remove the first slash and put it in
# `donepath' meaning that we treat it as the path that was already handled.
# Also, we don't use the paths from `-W'.
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next prev parent reply other threads:[~2001-07-06 9:26 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-07-06 5:14 Andrej Borsenkow
2001-07-06 9:24 ` Sven Wischnowsky [this message]
2001-07-06 10:32 ` Andrej Borsenkow
2001-07-06 10:41 ` Sven Wischnowsky
2001-07-06 11:03 ` Andrej Borsenkow
2001-07-06 11:16 ` Andrej Borsenkow
2001-07-06 12:22 ` Sven Wischnowsky
2001-07-06 12:34 ` Andrej Borsenkow
2001-07-13 12:22 ` Andrej Borsenkow
2001-07-17 9:02 ` PATCH: " 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=200107060924.LAA12231@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).