From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11772 invoked from network); 1 Dec 1999 09:48:40 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 1 Dec 1999 09:48:40 -0000 Received: (qmail 9292 invoked by alias); 1 Dec 1999 09:48:35 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 8834 Received: (qmail 9285 invoked from network); 1 Dec 1999 09:48:34 -0000 Date: Wed, 1 Dec 1999 10:48:33 +0100 (MET) Message-Id: <199912010948.KAA14713@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk Subject: 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@informatik.hu-berlin.de