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

PATCH: Re: bindkey bug with zsh-3.1.6-dev-21?



I wrote:

> ...
> 
> Hm, maybe a test of the form
> 
>   if (load(zle) || !loaded(complete)) load(compctl);
> 
> There's find_module() for that kind of test.
> 
> Does that sound sensible?

Oops. No, Sven, we can't do that in autoload_zleread(), obviously.

So this puts the test in docomplete().

And it adds module_loaded() which can be used to test if a module is
really loaded.

Bye
 Sven

Index: Src/module.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/module.c,v
retrieving revision 1.1.1.35
diff -u -r1.1.1.35 module.c
--- Src/module.c	2000/02/23 15:18:45	1.1.1.35
+++ Src/module.c	2000/04/19 13:40:33
@@ -447,6 +447,18 @@
 }
 
 /**/
+mod_export int
+module_loaded(const char *name)
+{
+    LinkNode node;
+    Module m;
+
+    return ((node = find_module(name)) &&
+	    (m = ((Module) getdata(node)))->u.handle &&
+	    !(m->flags & MOD_UNLOAD));
+}
+
+/**/
 #ifdef DYNAMIC
 
 /**/
Index: Src/Zle/zle_tricky.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_tricky.c,v
retrieving revision 1.6
diff -u -r1.6 zle_tricky.c
--- Src/Zle/zle_tricky.c	2000/04/17 11:17:10	1.6
+++ Src/Zle/zle_tricky.c	2000/04/19 13:40:34
@@ -523,6 +523,9 @@
     if (undoing)
 	setlastline();
 
+    if (!module_loaded("zsh/complete"))
+	load_module("zsh/compctl");
+
     if (runhookdef(BEFORECOMPLETEHOOK, (void *) &lst))
 	return 0;
 

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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