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

PATCH: make compadd create empty groups



This ensures that compadd without matches but with a -[JV] at least
creates the group (and otherwise does nothing else). This allows us to 
easily ensure a certain ordering of groups by just creating them with
`compadd -J foo' at the beginning. In a patch to follow.

Bye
 Sven

diff -u oldsrc/Zle/compcore.c Src/Zle/compcore.c
--- oldsrc/Zle/compcore.c	Mon Nov 29 10:10:36 1999
+++ Src/Zle/compcore.c	Wed Dec  1 10:19:24 1999
@@ -1686,6 +1686,17 @@
 		    }
 		}
 	    }
+	    /* Select the group in which to store the matches. */
+	    gflags = (((dat->aflags & CAF_NOSORT ) ? CGF_NOSORT  : 0) |
+		      ((dat->aflags & CAF_UNIQALL) ? CGF_UNIQALL : 0) |
+		      ((dat->aflags & CAF_UNIQCON) ? CGF_UNIQCON : 0));
+	    if (dat->group) {
+		endcmgroup(NULL);
+		begcmgroup(dat->group, gflags);
+	    } else {
+		endcmgroup(NULL);
+		begcmgroup("default", 0);
+	    }
 	    if (*argv) {
 		if (dat->pre)
 		    dat->pre = dupstring(dat->pre);
@@ -1696,17 +1707,6 @@
 		    untokenize(dat->prpre);
 		} else
 		    dat->prpre = dupstring(dat->prpre);
-		/* Select the group in which to store the matches. */
-		gflags = (((dat->aflags & CAF_NOSORT ) ? CGF_NOSORT  : 0) |
-			  ((dat->aflags & CAF_UNIQALL) ? CGF_UNIQALL : 0) |
-			  ((dat->aflags & CAF_UNIQCON) ? CGF_UNIQCON : 0));
-		if (dat->group) {
-		    endcmgroup(NULL);
-		    begcmgroup(dat->group, gflags);
-		} else {
-		    endcmgroup(NULL);
-		    begcmgroup("default", 0);
-		}
 		/* Select the set of matches. */
 		oisalt = (dat->aflags & CAF_ALT);
 
diff -u oldsrc/Zle/complete.c Src/Zle/complete.c
--- oldsrc/Zle/complete.c	Mon Nov 29 10:10:36 1999
+++ Src/Zle/complete.c	Wed Dec  1 10:41:14 1999
@@ -599,7 +599,9 @@
 	}
     }
  ca_args:
-    if (!*argv)
+
+    if (!*argv && !dat.group &&
+	!(dat.aflags & (CAF_NOSORT|CAF_UNIQALL|CAF_UNIQCON)))
 	return 1;
 
     dat.match = match = cpcmatcher(match);

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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