From d14a675a8459e1e1ae6e9862cb9a38dcceec5c4a Mon Sep 17 00:00:00 2001 From: Paul Ackersviller Date: Sun, 18 Nov 2007 19:08:14 +0000 Subject: Merge of 23363: fake-files style now takes pattern. --- Doc/Zsh/compsys.yo | 7 ++++++- README | 16 ++++++++++++++++ Src/Zle/computil.c | 13 +++++++++++-- 3 files changed, 33 insertions(+), 3 deletions(-) diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index 74cb26a0a..9b2063209 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 c027f94d6..bb894c2f7 100644 --- a/README +++ b/README @@ -60,6 +60,22 @@ 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 +on some fairly common PC configurations. This change is only likely to +affect some highly specialised uses of the shell. + +The variables HISTCHARS and histchars now reject any attempt to +set non-ASCII characters for history or comments. Multibyte characters +have never worked and the most consistent change was to restrict the +set to portable characters only. + Documentation ------------- diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c index 9ed1e83f3..84c4a806b 100644 --- a/Src/Zle/computil.c +++ b/Src/Zle/computil.c @@ -4169,14 +4169,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) { @@ -4184,9 +4190,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))) { -- cgit 1.4.1