zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@sunsite.dk
Subject: Re: compctl -g not working
Date: Sun, 14 Oct 2001 01:45:04 +0000	[thread overview]
Message-ID: <1011014014504.ZM4574@candle.brasslantern.com> (raw)
In-Reply-To: <15297.40098.68834.268916@gargle.gargle.HOWL>

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   


      reply	other threads:[~2001-10-14  1:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20011002225307.A13954@astaroth.sweth.net>
     [not found] ` <87adz976ru.fsf@ceramic.fifi.org>
     [not found]   ` <20011002231841.B14325@astaroth.sweth.net>
     [not found]     ` <1011003040449.ZM25370@candle.brasslantern.com>
     [not found]       ` <20011003001256.B14675@astaroth.sweth.net>
     [not found]         ` <1011003060441.ZM25764@candle.brasslantern.com>
     [not found]           ` <20011003021524.A15356@astaroth.sweth.net>
     [not found]             ` <1011003162422.ZM29481@candle.brasslantern.com>
     [not found]               ` <20011003142330.A16765@astaroth.sweth.net>
     [not found]                 ` <1011004042305.ZM30162@candle.brasslantern.com>
     [not found]                   ` <20011004004307.C18930@astaroth.sweth.net>
     [not found]                     ` <1011005161336.ZM32521@candle.brasslantern.com>
     [not found]                       ` <20011005172343.A2872@fysh.org>
2001-10-05 16:45                         ` BARE_GLOB_QUAL Bart Schaefer
2001-10-05 16:56                           ` BARE_GLOB_QUAL Zefram
2001-10-05 17:20                             ` BARE_GLOB_QUAL Bart Schaefer
2001-10-08 12:31                       ` compctl -g not working Sven Wischnowsky
2001-10-14  1:45                         ` Bart Schaefer [this message]

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=1011014014504.ZM4574@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --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).