Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: (was Re: _configure does not work)



Andrej Borsenkow wrote:

> (patches up to and including 5962)
> 
> bor@itsrm2:~%> zsh -f
> itsrm2% cd /tools/src
> itsrm2% cd zsh-3.1.5-pws-11 
> itsrm2% fpath=($PWD/Completion/*(/))
> itsrm2% source Completion/Core/compinit
> itsrm2% ./configure --prefix=/t<TAB>
>    B-e-e-p

The reason for this was that `_configure' didn't give a pattern and
action for things like `=PREFIX'. That's why I said I would like to
know about more patterns that should be used in the functions using
`_long_options'.

> itsrm2% ./configure --e-d<TAB>
> itsrm2% ./configure
>  (the whole stuff deleted)
> 
> I'd thought, it completed to at least --enable-dynamic before.

I think it didn't, I think it generated a list containing
`--enable-dynamic', `--enable-zsh-debug' and others. This was wrong in 
the matching code in zle_tricky.c.

Ok, the patch below changes zle_tricky.c to match only a sub-string up 
to a partial-word-separator for each such match spec and it changes
`_configure' to accept some more patterns.


Bye
 Sven

diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Mon Mar  8 10:23:41 1999
+++ Src/Zle/zle_tricky.c	Tue Mar  9 11:00:03 1999
@@ -3453,11 +3453,20 @@
 				 * characters are matched by the `*' pattern.
 				 * We do this by looping over the string
 				 * and calling this function recursively. */
-				int i = 0, j = iw, k = lw;
+				int i = 0, j = iw, k = lw, m = 0;
 				int jj = il + mp->llen, kk = ll - mp->llen;
 				char *p = l + mp->llen, *q = w;
 
 				for (; k; i++, j++, k--, q++) {
+				    if ((mp->flags & CMF_RIGHT) &&
+					(mp->right && k >= mp->ralen &&
+					 pattern_match(mp->right, q, 
+						       NULL, NULL))) {
+					if (m++) {
+					    k = 0;
+					    break;
+					}
+				    }
 				    if (match_pfx(p, q, NULL, NULL, NULL, NULL))
 					break;
 				}
@@ -3679,13 +3688,23 @@
 				     !pattern_match(mp->left, w - mp->lalen,
 						    NULL, NULL));
 			    if (t) {
-				int i = 0, j = iw, k = lw;
+				int i = 0, j = iw, k = lw, m = 0;
 				int jj = il + mp->llen, kk = ll - mp->llen;
 				char *p = l - mp->llen - 1, *q = w - 1;
 
-				for (; k; i++, j++, k--, q--)
+				for (; k; i++, j++, k--, q--) {
+				    if ((mp->flags & CMF_LEFT) &&
+					(mp->left && k >= mp->lalen &&
+					 pattern_match(mp->left, q - mp->lalen, 
+						       NULL, NULL))) {
+					if (m++) {
+					    k = 0;
+					    break;
+					}
+				    }
 				    if (match_pfx(p, q, NULL, NULL, NULL, NULL))
 					break;
+				}
 				if (k && i) {
 				    if (nlp) {
 					nw = addtoword(&rw, &rwlen, nw, mp,
@@ -4195,7 +4214,6 @@
 		t = s;
 		if (ppre)
 		    t = dyncat(ppre, t);
-		lc = NULL;
 		if (!cp && !ms && (mstack || psuf)) {
 		    int bl = ((aflags & CAF_MATCH) ? llpl : 0);
 		    Cline *clp = &lc, tlc;
diff -u oc/User/_configure Completion/User/_configure
--- oc/User/_configure	Mon Mar  8 11:05:13 1999
+++ Completion/User/_configure	Tue Mar  9 11:02:02 1999
@@ -1,3 +1,4 @@
 #defcomp configure
 
-_long_options
+_long_options '*=(E|)PREFIX*' '_files -/' \
+              '*=PROGRAM*'    '_command_names'

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author