zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: make _urls magicequalsubst aware
@ 2000-06-17 18:34 Tanaka Akira
  2000-06-17 19:31 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Tanaka Akira @ 2000-06-17 18:34 UTC (permalink / raw)
  To: zsh-workers

Z(2):akr@flux% Src/zsh -f
flux% bindkey -e; autoload -U compinit; compinit -D
flux% setopt magicequalsubst 
flux% curl <TAB>
_urls:56: glob not found

Hm.  `g:=glob' should be quoted.

Index: Completion/User/_urls
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_urls,v
retrieving revision 1.13
diff -u -r1.13 _urls
--- Completion/User/_urls	2000/06/08 14:36:25	1.13
+++ Completion/User/_urls	2000/06/17 18:32:05
@@ -53,7 +53,7 @@
 fi
 
 glob=(-g '*(^/)')
-zparseopts -D -K -E g:=glob
+zparseopts -D -K -E 'g:=glob'
 
 ipre="$IPREFIX"
 
-- 
Tanaka Akira


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: make _urls magicequalsubst aware
  2000-06-17 18:34 PATCH: make _urls magicequalsubst aware Tanaka Akira
@ 2000-06-17 19:31 ` Bart Schaefer
  2000-06-17 19:46   ` PATCH: magicequalsubst (Re: PATCH: make _urls magicequalsubst aware) Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2000-06-17 19:31 UTC (permalink / raw)
  To: Tanaka Akira, zsh-workers

On Jun 18,  3:34am, Tanaka Akira wrote:
} Subject: PATCH: make _urls magicequalsubst aware
}
} Hm.  `g:=glob' should be quoted.

That's indirectly my fault.  I wondered aloud why it was quoted, and so
the next patch unquoted it.

However, that's surely a bug in magicequalsubst handling:

MAGIC_EQUAL_SUBST
     All unquoted arguments of the form `ANYTHING=EXPRESSION' appearing
     after the command name have filename expansion (that is, where
     EXPRESSION has a leading `~' or `=') performed on EXPRESSION as if
     it were a parameter assignment.  The argument is not otherwise
     treated specially; it is passed to the command as a single
     argument, and not used as an actual parameter assignment.  For
     example, in echo foo=~/bar:~/rod, both occurrences of ~ would be
     replaced.  Note that this happens anyway with typeset and similar
     statements.

g:=glob should have ANYTHING of `g:' and EXPRESSION of `glob'.  There's
no expansion to be peformed on `glob'.  How is the `=' getting taken to
be part of the EXPRESSION?

-- 
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   


^ permalink raw reply	[flat|nested] 3+ messages in thread

* PATCH: magicequalsubst (Re: PATCH: make _urls magicequalsubst aware)
  2000-06-17 19:31 ` Bart Schaefer
@ 2000-06-17 19:46   ` Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2000-06-17 19:46 UTC (permalink / raw)
  To: zsh-workers

On Jun 17,  7:31pm, Bart Schaefer wrote:
} Subject: Re: PATCH: make _urls magicequalsubst aware
}
} On Jun 18,  3:34am, Tanaka Akira wrote:
} } Subject: PATCH: make _urls magicequalsubst aware
} }
} } Hm.  `g:=glob' should be quoted.
} 
} g:=glob should have ANYTHING of `g:' and EXPRESSION of `glob'.  There's
} no expansion to be peformed on `glob'.  How is the `=' getting taken to
} be part of the EXPRESSION?

This fixes that, so 11959 is now unecessary but harmless.

Index: Src/subst.c
===================================================================
@@ -307,7 +307,7 @@
 mod_export void
 filesub(char **namptr, int assign)
 {
-    char *sub = NULL, *str, *ptr;
+    char *eql = NULL, *sub = NULL, *str, *ptr;
     int len;
 
     filesubstr(namptr, assign);
@@ -316,7 +316,7 @@
 	return;
 
     if (assign & PF_TYPESET) {
-	if ((*namptr)[1] && (sub = strchr(*namptr + 1, Equals))) {
+	if ((*namptr)[1] && (eql = sub = strchr(*namptr + 1, Equals))) {
 	    str = sub + 1;
 	    if ((sub[1] == Tilde || sub[1] == Equals) && filesubstr(&str, assign)) {
 		sub[1] = '\0';
@@ -330,7 +330,9 @@
     while ((sub = strchr(ptr, ':'))) {
 	str = sub + 1;
 	len = sub - *namptr;
-	if ((sub[1] == Tilde || sub[1] == Equals) && filesubstr(&str, assign)) {
+	if (sub > eql &&
+	    (sub[1] == Tilde || sub[1] == Equals) &&
+	    filesubstr(&str, assign)) {
 	    sub[1] = '\0';
 	    *namptr = dyncat(*namptr, str);
 	}

-- 
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   


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-06-17 19:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-17 18:34 PATCH: make _urls magicequalsubst aware Tanaka Akira
2000-06-17 19:31 ` Bart Schaefer
2000-06-17 19:46   ` PATCH: magicequalsubst (Re: PATCH: make _urls magicequalsubst aware) Bart Schaefer

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).