From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1558 invoked from network); 20 Aug 2002 12:26:04 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 20 Aug 2002 12:26:04 -0000 Received: (qmail 20739 invoked by alias); 20 Aug 2002 12:25:54 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 17567 Received: (qmail 20726 invoked from network); 20 Aug 2002 12:25:53 -0000 From: Sven Wischnowsky MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15714.12003.280325.857811@wischnow.berkom.de> Date: Tue, 20 Aug 2002 13:58:27 +0200 To: zsh-workers@sunsite.dk Subject: Re: About menu selection (again) In-Reply-To: <1020817172639.ZM6260@candle.brasslantern.com> References: <3D56CD6E.mailMX1LBVZ3@viadomus.com> <1020812060148.ZM28748@candle.brasslantern.com> <3D5906BF.mail17S21TJ8M@viadomus.com> <1020813150050.ZM30758@candle.brasslantern.com> <3D5954F7.mail1L21A9GN@viadomus.com> <3D595620.mail3I11T8QF@viadomus.com> <1020814022702.ZM31935@candle.brasslantern.com> <3D5CEB3E.mailV211HY5E@viadomus.com> <15708.60068.71382.607117@wischnow.berkom.de> <1020817172639.ZM6260@candle.brasslantern.com> X-Mailer: VM 7.03 under 21.5 (patch 5) "beets" XEmacs Lucid Bart Schaefer wrote: > ... > > Could we do something along the lines of shuffling the hookdefs so that > the completion hooks are not defined until `zle -C' runs the first time, > even if the zsh/complete module has been loaded? And then test for the > presence of the hook rather than the presence of the module, and load > compctl if the hook doesn't exist? Sorry for the delay, we had problems with our router... We should actually be able to get by with just a tiny flag, that's set when a completion widget is defined. Or am I wrong. Ideally, this should really check, if any completion widgets are bound to keys, shouldn't it? Bye Sven Index: Src/Zle/zle_main.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_main.c,v retrieving revision 1.26 diff -u -r1.26 zle_main.c --- Src/Zle/zle_main.c 4 Jul 2002 10:13:38 -0000 1.26 +++ Src/Zle/zle_main.c 20 Aug 2002 11:52:58 -0000 @@ -1355,6 +1355,7 @@ varedarg = NULL; incompfunc = incompctlfunc = hascompmod = 0; + hascompwidgets = 0; clwords = (char **) zcalloc((clwsize = 16) * sizeof(char *)); Index: Src/Zle/zle_thingy.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_thingy.c,v retrieving revision 1.8 diff -u -r1.8 zle_thingy.c --- Src/Zle/zle_thingy.c 7 Jun 2002 18:04:14 -0000 1.8 +++ Src/Zle/zle_thingy.c 20 Aug 2002 11:52:58 -0000 @@ -601,6 +601,8 @@ zwarnnam(name, "widget name `%s' is protected", args[0], 0); return 1; } + hascompwidgets++; + return 0; } Index: Src/Zle/zle_tricky.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_tricky.c,v retrieving revision 1.39 diff -u -r1.39 zle_tricky.c --- Src/Zle/zle_tricky.c 8 Jul 2002 09:03:05 -0000 1.39 +++ Src/Zle/zle_tricky.c 20 Aug 2002 11:52:58 -0000 @@ -146,6 +146,11 @@ /**/ mod_export int comprecursive; +/* != 0 if there are any defined completion widgets. */ + +/**/ +int hascompwidgets; + /* Find out if we have to insert a tab (instead of trying to complete). */ /**/ @@ -557,7 +562,11 @@ if (undoing) setlastline(); - if (!module_loaded("zsh/complete")) + /* We the C-code's point of view, we can only use compctl as a default + * type of completion. Load it if it hasn't been loaded already and + * no completion widgets are defined. */ + + if (!module_loaded("zsh/compctl") && !hascompwidgets) load_module("zsh/compctl"); if (runhookdef(BEFORECOMPLETEHOOK, (void *) &lst)) { -- Sven Wischnowsky wischnow@berkom.de