summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Doc/Zsh/compsys.yo7
-rw-r--r--README5
-rw-r--r--Src/Zle/computil.c13
4 files changed, 27 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index c581b8679..24cf1c3f5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-05-01 Peter Stephenson <pws@csr.com>
+
+ * 23363: README (not posted), Doc/Zsh/compsys.yo,
+ Src/Zle/computil.c: fake-files style now takes pattern.
+
2007-04-30 Peter Stephenson <pws@csr.com>
* 23339: Src/mem.c: make malloc(0) allocate a single byte
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index de2fcc260..48df05471 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -1340,12 +1340,17 @@ without a tag. Its values are of the form
`var(dir)tt(:)var(names...)'. This will add the var(names) (strings
separated by spaces) as
possible matches when completing in the directory var(dir), even if no
-such files really exist.
+such files really exist. The dir may be a pattern; pattern characters
+or colons in var(dir) should be quote with a backslash to be treated
+literally.
This can be useful on systems that support special filesystems whose
top-level pathnames can not be listed or generated with glob patterns.
It can also be used for directories for which one does not have read
permission.
+
+The pattern form can be used to add a certain `magic' entry
+to all directories on a particular filing system.
)
kindex(fake-parameters, completion style)
item(tt(fake-parameters))(
diff --git a/README b/README
index 3c3a10e39..e01bc81ec 100644
--- a/README
+++ b/README
@@ -104,6 +104,11 @@ change was necessary because otherwise recursive directories under
hit for anyone not using PINE. The previous default can be restored with:
zstyle ':completion:*' pine-directory ~/mail
+The completion style fake-files now allows patterns as directories,
+for example the value '/home/*:.snapshot' is now valid. This will
+only cause problems in the unlikely event that a directory in the style
+has a pattern character in it.
+
The default maximum function depth (configurable with
--enable-max-function-depth) has been decreased to 1000 from 4096. The
previous value was observed to be large enough that crashes still occurred
diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c
index f9c55296c..dbbaa61e2 100644
--- a/Src/Zle/computil.c
+++ b/Src/Zle/computil.c
@@ -4247,14 +4247,20 @@ cfp_add_sdirs(LinkList final, LinkList orig, char *skipped,
char *m, *f, *p, *t, *a, c;
int sl = strlen(skipped) + 1;
struct stat st1, st2;
+ Patprog pprog;
for (; (f = *fake); fake++) {
f = dupstring(f);
for (p = t = f; *p; p++) {
if (*p == ':')
break;
- else if (*p == '\\' && p[1])
+ else if (*p == '\\' && p[1] == ':') {
+ /*
+ * strip quoted colons here; rely
+ * on tokenization to strip other backslashes
+ */
p++;
+ }
*t++ = *p;
}
if (*p) {
@@ -4262,9 +4268,12 @@ cfp_add_sdirs(LinkList final, LinkList orig, char *skipped,
if (!*p)
continue;
+ tokenize(f);
+ pprog = patcompile(f, PAT_STATIC, NULL);
+ untokenize(f);
for (node = firstnode(orig); node; incnode(node)) {
if ((m = (char *) getdata(node)) &&
- (!strcmp(f, m) ||
+ ((pprog ? pattry(pprog, m) : !strcmp(f, m)) ||
(!stat(f, &st1) && !stat((*m ? m : "."), &st2) &&
st1.st_dev == st2.st_dev &&
st1.st_ino == st2.st_ino))) {