From: Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
To: zsh-workers@sunsite.auc.dk (Zsh hackers list)
Subject: PATCH: _cd not completing in $cdpath
Date: Thu, 23 Dec 1999 21:54:06 +0000 [thread overview]
Message-ID: <E121GA8-0008Mh-00.1999-12-23-21-52-45@mail4.svr.pol.co.uk> (raw)
(Andrej just reported this after I'd noticed it. I've left in the fact
that . gets removed. I think this is to do with the local-directories and
path-directories tag being separate; local files do get completed at some
point.)
_alternative re-evaluates arguments passed to it, so a string like
'\(/home/pws /home/pws/tex\)'
isn't good enough as a path for _path_files -W because it gets split on
spaces, whereas _path_files needs it as a single argument. If that's the
correct behaviour for _alternative --- and I suspect it is, because there
are uses like
_alternative 'files:: _files' 'parameters:: _parameters'
--- then _cd needs fixing.
The simple solution, passing the name of a parameter instead of the
concocted string, took me ages to think of. It turns out then that an
extra fix is required in _path_files for directories with spaces in: the
parameter was split with an extra ${=...}, which seems to me unnecessary
since it should be a proper array anyway, that's what they're for.
Index: Completion/Builtins/_cd
===================================================================
RCS file: /home/pws/CVSROOT/projects/zsh/Completion/Builtins/_cd,v
retrieving revision 1.3
diff -u -r1.3 _cd
--- Completion/Builtins/_cd 1999/12/15 19:44:32 1.3
+++ Completion/Builtins/_cd 1999/12/23 15:51:12
@@ -37,9 +37,11 @@
PREFIX="~$PREFIX"
_path_files -/
else
+ local tmpcdpath
+ tmpcdpath=(${(@)cdpath:#.})
_alternative \
'local-directories:local directories:_path_files -/' \
- "path-directories: directories in cdpath:_path_files -W \\(${${(@)cdpath:#.}}\\) -/"
+ "path-directories:directories in cdpath:_path_files -W tmpcdpath -/"
fi
else
_path_files -/
Index: Completion/Core/_path_files
===================================================================
RCS file: /home/pws/CVSROOT/projects/zsh/Completion/Core/_path_files,v
retrieving revision 1.10
diff -u -r1.10 _path_files
--- Completion/Core/_path_files 1999/12/15 19:44:32 1.10
+++ Completion/Core/_path_files 1999/12/23 15:47:25
@@ -44,7 +44,9 @@
if [[ "$tmp1[1]" = '(' ]]; then
prepaths=( ${^=tmp1[2,-2]%/}/ )
else
- prepaths=( ${(P)^=tmp1%/}/ )
+ # In this case the variable should be an array, so
+ # don't use an extra ${=...}.
+ prepaths=( ${(P)^tmp1%/}/ )
(( ! $#prepaths )) && prepaths=( ${tmp1%/}/ )
fi
(( ! $#prepaths )) && prepaths=( '' )
--
Peter Stephenson <pws@pwstephenson.fsnet.co.uk>
next reply other threads:[~1999-12-23 21:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-12-23 21:54 Peter Stephenson [this message]
1999-12-25 10:57 ` Arguments splitting (was: RE: PATCH: _cd not completing in $cdpath) Andrej Borsenkow
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=E121GA8-0008Mh-00.1999-12-23-21-52-45@mail4.svr.pol.co.uk \
--to=pws@pwstephenson.fsnet.co.uk \
--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).