Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: About menu selection (again)
- X-seq: zsh-workers 17567
- From: Sven Wischnowsky <wischnow@xxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: About menu selection (again)
- Date: Tue, 20 Aug 2002 13:58:27 +0200
- In-reply-to: <1020817172639.ZM6260@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <3D56CD6E.mailMX1LBVZ3@xxxxxxxxxxxx> <1020812060148.ZM28748@xxxxxxxxxxxxxxxxxxxxxxx> <3D5906BF.mail17S21TJ8M@xxxxxxxxxxxx> <1020813150050.ZM30758@xxxxxxxxxxxxxxxxxxxxxxx> <3D5954F7.mail1L21A9GN@xxxxxxxxxxxx> <3D595620.mail3I11T8QF@xxxxxxxxxxxx> <1020814022702.ZM31935@xxxxxxxxxxxxxxxxxxxxxxx> <3D5CEB3E.mailV211HY5E@xxxxxxxxxxxx> <15708.60068.71382.607117@xxxxxxxxxxxxxxxxxx> <1020817172639.ZM6260@xxxxxxxxxxxxxxxxxxxxxxx>
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@xxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author