Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: compctl -g not working
- X-seq: zsh-workers 16032
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: compctl -g not working
- Date: Sun, 14 Oct 2001 01:45:04 +0000
- In-reply-to: <15297.40098.68834.268916@xxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20011002225307.A13954@xxxxxxxxxxxxxxxxxx> <87adz976ru.fsf@xxxxxxxxxxxxxxxx> <20011002231841.B14325@xxxxxxxxxxxxxxxxxx> <1011003040449.ZM25370@xxxxxxxxxxxxxxxxxxxxxxx> <20011003001256.B14675@xxxxxxxxxxxxxxxxxx> <1011003060441.ZM25764@xxxxxxxxxxxxxxxxxxxxxxx> <20011003021524.A15356@xxxxxxxxxxxxxxxxxx> <1011003162422.ZM29481@xxxxxxxxxxxxxxxxxxxxxxx> <20011003142330.A16765@xxxxxxxxxxxxxxxxxx> <1011004042305.ZM30162@xxxxxxxxxxxxxxxxxxxxxxx> <20011004004307.C18930@xxxxxxxxxxxxxxxxxx> <1011005161336.ZM32521@xxxxxxxxxxxxxxxxxxxxxxx> <15297.40098.68834.268916@xxxxxxxxxxxxxxxxxx>
On Oct 8, 2:31pm, Sven Wischnowsky wrote:
} Subject: Re: compctl -g not working
}
} [ moved to -workers ]
}
} Bart Schaefer wrote:
}
} > Should we fix `compctl -g' so that it behaves like "ordinary" globbing?
} > (I have a suggested implementation that I won't go into here.)
}
} Would be fine with me. (I really don't care about compctl anymore ;-)
This affects compcore as well, though, and everywhere else that zsh uses
tokenize(). That doesn't affect compsys much because we force SH_GLOB
off via $_comp_options, but it could affect other completion widgets.
Here's a patch for consideration. It renames tokenize() as shtokenize(),
and then makes tokenize() a wrapper for shtokenize() that always turns
off SH_GLOB. Then shtokenize() is called selectively in the places where
(as best I can tell) we really want SH_GLOB behavior to apply.
Obviously this is a little inefficient, since tokenize() is used a lot
more often than shtokenize(). There are several ways to improve this,
but this way lets us test the new behavior with a minimum of rewriting.
Of course, you shouldn't see any change in behavior unless you were using
SH_GLOB in the first place ...
Index: Src/exec.c
--- zsh-forge/current/Src/exec.c Thu Oct 11 11:11:07 2001
+++ zsh-4.0/Src/exec.c Sat Oct 13 12:58:11 2001
@@ -2794,7 +2794,7 @@
while (*words) {
if (isset(GLOBSUBST))
- tokenize(*words);
+ shtokenize(*words);
addlinknode(ret, *words++);
}
}
Index: Src/glob.c
--- zsh-forge/current/Src/glob.c Mon Oct 8 03:04:01 2001
+++ zsh-4.0/Src/glob.c Sat Oct 13 12:57:27 2001
@@ -2329,6 +2329,16 @@
mod_export void
tokenize(char *s)
{
+ char shglob = opts[SHGLOB];
+ opts[SHGLOB] = 0;
+ shtokenize(s);
+ opts[SHGLOB] = shglob;
+}
+
+/**/
+mod_export void
+shtokenize(char *s)
+{
char *t;
int bslash = 0;
Index: Src/subst.c
--- zsh-forge/current/Src/subst.c Mon Oct 8 03:04:01 2001
+++ zsh-4.0/Src/subst.c Sat Oct 13 12:58:13 2001
@@ -190,7 +190,7 @@
continue;
}
if (!qt && ssub && isset(GLOBSUBST))
- tokenize(s);
+ shtokenize(s);
l1 = str2 - str3;
l2 = strlen(s);
if (nonempty(pl)) {
@@ -441,14 +441,14 @@
if (!pl && (!s || !*s)) {
*d = dest = (copied ? src : dupstring(src));
if (glbsub)
- tokenize(dest);
+ shtokenize(dest);
} else {
*d = dest = hcalloc(pl + l + (s ? strlen(s) : 0) + 1);
strncpy(dest, pb, pl);
dest += pl;
strcpy(dest, src);
if (glbsub)
- tokenize(dest);
+ shtokenize(dest);
dest += l;
if (s)
strcpy(dest, s);
@@ -1509,7 +1509,7 @@
if (!quoteerr) {
errflag = oef;
if (haserr)
- tokenize(s);
+ shtokenize(s);
} else if (haserr || errflag) {
zerr("parse error in ${...%c...} substitution",
NULL, s[-1]);
@@ -1955,7 +1955,7 @@
else {
y = dupstring(x);
if (globsubst)
- tokenize(y);
+ shtokenize(y);
}
insertlinknode(l, n, (void *) y), incnode(n);
}
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
Messages sorted by:
Reverse Date,
Date,
Thread,
Author