* About menu selection (again) @ 2002-08-11 20:47 DervishD 2002-08-12 6:01 ` Bart Schaefer 0 siblings, 1 reply; 16+ messages in thread From: DervishD @ 2002-08-11 20:47 UTC (permalink / raw) To: Zsh Hi all :)) (Bart specially ;)) I've discovered why the menu selection wasn't working for me. The problem seems to be the module 'zsh/compctl', not loaded by default in my system. If this module is not loaded, then the menu selection doesn't work, neither do completion. I've added 'zmodload zsh/compctl zsh/complist' to the end of my /etc/zshrc and now all works ok. I'm obviously not aware of something... And well, excuses for all the messages I've written concerning completion, but it is somewhat 'black magic' for me. And thanks to Bart for all his help. Definitely, I owe you a beer ;)))) And the most important: thanks for zsh. I couldn't live without it. I'm returning to bash only in my worst nightmares... Raúl ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: About menu selection (again) 2002-08-11 20:47 About menu selection (again) DervishD @ 2002-08-12 6:01 ` Bart Schaefer 2002-08-13 13:16 ` DervishD 0 siblings, 1 reply; 16+ messages in thread From: Bart Schaefer @ 2002-08-12 6:01 UTC (permalink / raw) To: DervishD, Zsh On Aug 11, 10:47pm, DervishD wrote: } } I've discovered why the menu selection wasn't working for me. The } problem seems to be the module 'zsh/compctl', not loaded by default } in my system. Hm. But ... you said in your other message that it works with `zsh -f'. So how is it that the compctl module gets loaded for `zsh -f' yet not when you let zsh read your rc files? There must be something else going on here. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: About menu selection (again) 2002-08-12 6:01 ` Bart Schaefer @ 2002-08-13 13:16 ` DervishD 2002-08-13 15:00 ` Bart Schaefer 0 siblings, 1 reply; 16+ messages in thread From: DervishD @ 2002-08-13 13:16 UTC (permalink / raw) To: schaefer, zsh-workers, raul Hi Bart :) >} I've discovered why the menu selection wasn't working for me. The >} problem seems to be the module 'zsh/compctl', not loaded by default >} in my system. >Hm. But ... you said in your other message that it works with `zsh -f'. It works because compctl is loaded!. I don't know how it gets loaded, but it is :???? >So how is it that the compctl module gets loaded for `zsh -f' yet not >when you let zsh read your rc files? In my rc I don't load any module explicitly :?? >There must be something else going on here. Well, the fact is that if I load compctl and after that complist, all works OK, so I'm happy with this. Why I must load compctl is just curiosity ;)) Raúl ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: About menu selection (again) 2002-08-13 13:16 ` DervishD @ 2002-08-13 15:00 ` Bart Schaefer 2002-08-13 18:50 ` DervishD 0 siblings, 1 reply; 16+ messages in thread From: Bart Schaefer @ 2002-08-13 15:00 UTC (permalink / raw) To: DervishD, zsh-workers On Aug 13, 3:16pm, DervishD wrote: } } >} I've discovered why the menu selection wasn't working for me. The } >} problem seems to be the module 'zsh/compctl', not loaded by default } >} in my system. } >Hm. But ... you said in your other message that it works with `zsh -f'. } } It works because compctl is loaded!. I don't know how it gets } loaded, but it is :???? Normally zsh/zle and zsh/compctl are both loaded as soon as zsh is ready to print the prompt. I don't know of any way to prevent it other than to disable zle (e.g., run "zsh +Z"), or to have a messed-up module_path, but that can't be it because you've said you're using a static link. } Well, the fact is that if I load compctl and after that complist, } all works OK, so I'm happy with this. Why I must load compctl is just } curiosity ;)) If you're willing to look at it that way, OK. Me, I'd be worried that it means something else is broken, too. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: About menu selection (again) 2002-08-13 15:00 ` Bart Schaefer @ 2002-08-13 18:50 ` DervishD 2002-08-13 18:55 ` More information on why compctl is not loaded DervishD 0 siblings, 1 reply; 16+ messages in thread From: DervishD @ 2002-08-13 18:50 UTC (permalink / raw) To: schaefer, zsh-workers, raul Hi Bart :) >} It works because compctl is loaded!. I don't know how it gets >} loaded, but it is :???? >Normally zsh/zle and zsh/compctl are both loaded as soon as zsh is ready >to print the prompt. Well, when my login zsh starts, the only modules that are loaded are zsh/zle and zsh/main. zsh/compctl is not there. Maybe I'm not invoking any builtin in my rc's so compctl is autoloaded :?? >messed-up module_path, but >that can't be it because you've said you're using a static link. Yes, they are statically linked. I'm having an idea... What if I configured compctl prior to compilation as being statically linked but NOT autoloaded (I mean, with load=no in the .mdd file)? I don't have the mdd that I used for compilation, I'm afraid :((( But this can be the problem, true? >} Well, the fact is that if I load compctl and after that complist, >} all works OK, so I'm happy with this. Why I must load compctl is just >} curiosity ;)) >If you're willing to look at it that way, OK. Me, I'd be worried that it >means something else is broken, too. Yes, you are right, because if something is wrong, then other fails will arise sooner or later... Just that I have bigger problems than that ;))) Fortunately zsh works fine always ;)) Thanks for your help again, Bart. Raúl ^ permalink raw reply [flat|nested] 16+ messages in thread
* More information on why compctl is not loaded @ 2002-08-13 18:55 ` DervishD 2002-08-14 2:27 ` About menu selection (again) Bart Schaefer 0 siblings, 1 reply; 16+ messages in thread From: DervishD @ 2002-08-13 18:55 UTC (permalink / raw) To: Zsh Hi Bart :)) As I told you, zsh/compctl is not loaded at first. Well, as soon as I press TAB, both zsh/compctl and zsh/complete are loaded, but if zsh/complist is loaded, then *only* zsh/complete is loaded too at the same time and zsh/compctl is not loaded at all... Raúl ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: About menu selection (again) 2002-08-13 18:55 ` More information on why compctl is not loaded DervishD @ 2002-08-14 2:27 ` Bart Schaefer 2002-08-16 12:08 ` DervishD 0 siblings, 1 reply; 16+ messages in thread From: Bart Schaefer @ 2002-08-14 2:27 UTC (permalink / raw) To: DervishD, zsh-workers On Aug 13, 8:50pm, DervishD wrote: } } Well, when my login zsh starts, the only modules that are loaded } are zsh/zle and zsh/main. zsh/compctl is not there. Is that also the case when you start `zsh -f'? } Maybe I'm not } invoking any builtin in my rc's so compctl is autoloaded :?? That can't be, either, because `zsh -f' doesn't read your rc's ... } Yes, they are statically linked. I'm having an idea... What if I } configured compctl prior to compilation as being statically linked } but NOT autoloaded (I mean, with load=no in the .mdd file)? That might be it, but since you said later that pressing TAB causes it to autoload, it must not be. On Aug 13, 8:55pm, DervishD wrote: } } As I told you, zsh/compctl is not loaded at first. Well, as soon } as I press TAB, both zsh/compctl and zsh/complete are loaded, but if } zsh/complist is loaded, then *only* zsh/complete is loaded too at the } same time and zsh/compctl is not loaded at all... Aha. We have a winner. The default startup code explicitly loads both zsh/zle and zsh/compctl if zsh/zle has not already been loaded. Anything in your rc files that causes zsh/zle to be loaded, including bindkey, causes zsh/compctl to be skipped at startup. Next, the completion code loads zsh/compctl only if zsh/complete is not already loaded, but zsh/complist has a dependency on zsh/complete and zsh/zle, so if you load zsh/complist explicitly it blocks all possible routes to zsh/compctl except explicit autoloading or a compctl command. Whew. This should probably be considered a bug, but the only way I can think of to fix it is to use a different module than zsh/complete as the test for whether a completion system other than compctl is in use. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: About menu selection (again) 2002-08-14 2:27 ` About menu selection (again) Bart Schaefer @ 2002-08-16 12:08 ` DervishD 2002-08-16 12:05 ` Sven Wischnowsky 0 siblings, 1 reply; 16+ messages in thread From: DervishD @ 2002-08-16 12:08 UTC (permalink / raw) To: schaefer, zsh-workers, raul Hi Bart :) >} As I told you, zsh/compctl is not loaded at first. Well, as soon >} as I press TAB, both zsh/compctl and zsh/complete are loaded, but if >} zsh/complist is loaded, then *only* zsh/complete is loaded too at the >} same time and zsh/compctl is not loaded at all... >Aha. We have a winner. >The default startup code explicitly loads both zsh/zle and zsh/compctl if >zsh/zle has not already been loaded. Anything in your rc files that >causes zsh/zle to be loaded, including bindkey, causes zsh/compctl to be >skipped at startup. [...] Oh, then it is the problem. I use bindkey in my rc files. Since complist needs compctl to work, could it be added as a dependency? Well, thanks a lot for helping me on finding the problem :) Raúl ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: About menu selection (again) 2002-08-16 12:08 ` DervishD @ 2002-08-16 12:05 ` Sven Wischnowsky 2002-08-17 17:26 ` Bart Schaefer 2002-08-18 16:29 ` DervishD 0 siblings, 2 replies; 16+ messages in thread From: Sven Wischnowsky @ 2002-08-16 12:05 UTC (permalink / raw) To: zsh-workers DervishD wrote: > Hi Bart :) > > >} As I told you, zsh/compctl is not loaded at first. Well, as soon > >} as I press TAB, both zsh/compctl and zsh/complete are loaded, but if > >} zsh/complist is loaded, then *only* zsh/complete is loaded too at the > >} same time and zsh/compctl is not loaded at all... > >Aha. We have a winner. > >The default startup code explicitly loads both zsh/zle and zsh/compctl if > >zsh/zle has not already been loaded. Anything in your rc files that > >causes zsh/zle to be loaded, including bindkey, causes zsh/compctl to be > >skipped at startup. > [...] > > Oh, then it is the problem. I use bindkey in my rc files. Since > complist needs compctl to work, could it be added as a dependency? That would be wrong because complist doesn't need compctl. It only `needs' some form of completion to be useful and the new completion system is only built on top of the more basic `complete' module. Sigh. Bye Sven -- Sven Wischnowsky wischnow@berkom.de ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: About menu selection (again) 2002-08-16 12:05 ` Sven Wischnowsky @ 2002-08-17 17:26 ` Bart Schaefer 2002-08-19 7:40 ` Sven Wischnowsky 2002-08-20 11:58 ` Sven Wischnowsky 2002-08-18 16:29 ` DervishD 1 sibling, 2 replies; 16+ messages in thread From: Bart Schaefer @ 2002-08-17 17:26 UTC (permalink / raw) To: Sven Wischnowsky, zsh-workers On Aug 16, 2:05pm, Sven Wischnowsky wrote: } } DervishD wrote: } } > Since complist needs compctl to work, could it be added as a dependency? } } That would be wrong because complist doesn't need compctl. It only } `needs' some form of completion to be useful and the new completion } system is only built on top of the more basic `complete' module. The trouble is that the zsh/complete module is not a form of completion; it's a collection of tools for building forms of completion. It's useless unless `zle -C' has been run and that widget calls `compadd'. So the test in zle_tricky.c:docompletion for module_loaded("zsh/complete") is woefully inadequate. We need to at least test for `zle -C'. 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? -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: About menu selection (again) 2002-08-17 17:26 ` Bart Schaefer @ 2002-08-19 7:40 ` Sven Wischnowsky 2002-08-20 11:58 ` Sven Wischnowsky 1 sibling, 0 replies; 16+ messages in thread From: Sven Wischnowsky @ 2002-08-19 7:40 UTC (permalink / raw) To: zsh-workers 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? That sounds doable, I'll have a look. and in another mail: > One possibility might be to split the zsh/complete module still further, > to separate the part that implements the internals of compsys from the > part that complist depends on. (Maybe move that latter into compcore.c?) That, on the other hand, sounds like a rather horrible task. And I can't see any `sensible' line where to separate the parts. Bye Sven -- Sven Wischnowsky wischnow@berkom.de ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: About menu selection (again) 2002-08-17 17:26 ` Bart Schaefer 2002-08-19 7:40 ` Sven Wischnowsky @ 2002-08-20 11:58 ` Sven Wischnowsky 2002-08-20 15:07 ` Bart Schaefer 1 sibling, 1 reply; 16+ messages in thread From: Sven Wischnowsky @ 2002-08-20 11:58 UTC (permalink / raw) To: zsh-workers 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 ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: About menu selection (again) 2002-08-20 11:58 ` Sven Wischnowsky @ 2002-08-20 15:07 ` Bart Schaefer 2002-08-20 15:21 ` Sven Wischnowsky 0 siblings, 1 reply; 16+ messages in thread From: Bart Schaefer @ 2002-08-20 15:07 UTC (permalink / raw) To: zsh-workers On Aug 20, 1:58pm, Sven Wischnowsky wrote: } } Bart Schaefer wrote: } } > Could we do something along the lines of [...] } } 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. No, you're not wrong. I was thinking that it should be something tied to the module system so that if somebody else writes a completion module, it wouldn't need to know about this extra flag -- but any module that really wants to use compcore etc. has to tie into `zle -C', so it's probably OK. } Ideally, this should really check, if any completion widgets are bound } to keys, shouldn't it? That's not as obvious ... if no completion widgets are bound to keys, how would you get into docomplete() in the first place? } +/* != 0 if there are any defined completion widgets. */ } + } +/**/ } +int hascompwidgets; Shouldn't that be `mod_export int hascompwidgets;' ? } + /* We the C-code's point of view, we can only use compctl as a default "We the C-code"? In order to form a more perfect unix? -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: About menu selection (again) 2002-08-20 15:07 ` Bart Schaefer @ 2002-08-20 15:21 ` Sven Wischnowsky 0 siblings, 0 replies; 16+ messages in thread From: Sven Wischnowsky @ 2002-08-20 15:21 UTC (permalink / raw) To: zsh-workers Bart Schaefer wrote: > ... > > } Ideally, this should really check, if any completion widgets are bound > } to keys, shouldn't it? > > That's not as obvious ... if no completion widgets are bound to keys, how > would you get into docomplete() in the first place? It gets called from the standard widgets even if they haven't been overridden with user-defined (`zle -C') ones. > } +/* != 0 if there are any defined completion widgets. */ > } + > } +/**/ > } +int hascompwidgets; > > Shouldn't that be `mod_export int hascompwidgets;' ? > > } + /* We the C-code's point of view, we can only use compctl as a default > > "We the C-code"? In order to form a more perfect unix? Ahem. Bye Sven Index: Src/Zle/zle_tricky.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_tricky.c,v retrieving revision 1.40 diff -u -r1.40 zle_tricky.c --- Src/Zle/zle_tricky.c 20 Aug 2002 12:28:13 -0000 1.40 +++ Src/Zle/zle_tricky.c 20 Aug 2002 15:15:33 -0000 @@ -562,7 +562,7 @@ if (undoing) setlastline(); - /* We the C-code's point of view, we can only use compctl as a default + /* From 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. */ -- Sven Wischnowsky wischnow@berkom.de ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: About menu selection (again) 2002-08-16 12:05 ` Sven Wischnowsky 2002-08-17 17:26 ` Bart Schaefer @ 2002-08-18 16:29 ` DervishD 2002-08-18 23:07 ` Bart Schaefer 1 sibling, 1 reply; 16+ messages in thread From: DervishD @ 2002-08-18 16:29 UTC (permalink / raw) To: wischnow, zsh-workers Hi Sven :) >> Oh, then it is the problem. I use bindkey in my rc files. Since >> complist needs compctl to work, could it be added as a dependency? >That would be wrong because complist doesn't need compctl. [...] Is there a way to add a 'generic' dependency so a completion is loaded before 'complist'?. I mean: complist needs some form of completion to get menu selection to work, so if 'compctl' is not loaded, which other can I load?. Anyway, loading by hand compctl is not an issue (for me, at least). Raúl ^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: About menu selection (again) 2002-08-18 16:29 ` DervishD @ 2002-08-18 23:07 ` Bart Schaefer 0 siblings, 0 replies; 16+ messages in thread From: Bart Schaefer @ 2002-08-18 23:07 UTC (permalink / raw) To: DervishD, zsh-workers On Aug 18, 6:29pm, DervishD wrote: } } I mean: complist needs some form of completion to get menu selection to } work, so if 'compctl' is not loaded, which other can I load?. You can run `compinit' to load the "new" shell-function-based completion system. (We need to come up with a name for that; I suppose we can just call it "compsys" as that's the name of the manual section.) Currently the question "is a completion system loaded?" is tested as "is the zsh/complete module loaded?" The assumption being that no one would load zsh/complete unless they were going to make use of it. zsh/compctl gets loaded iff zsh/complete has not been. The problem is that zsh/complist has a dependency on zsh/complete -- which is a C-code dependency rather than a functional dependency, so it can't be dropped -- and that confuses the test by loading the module without any "form of completion" included. One possibility might be to split the zsh/complete module still further, to separate the part that implements the internals of compsys from the part that complist depends on. (Maybe move that latter into compcore.c?) -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net ^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2002-08-20 15:19 UTC | newest] Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2002-08-11 20:47 About menu selection (again) DervishD 2002-08-12 6:01 ` Bart Schaefer 2002-08-13 13:16 ` DervishD 2002-08-13 15:00 ` Bart Schaefer 2002-08-13 18:50 ` DervishD 2002-08-13 18:55 ` More information on why compctl is not loaded DervishD 2002-08-14 2:27 ` About menu selection (again) Bart Schaefer 2002-08-16 12:08 ` DervishD 2002-08-16 12:05 ` Sven Wischnowsky 2002-08-17 17:26 ` Bart Schaefer 2002-08-19 7:40 ` Sven Wischnowsky 2002-08-20 11:58 ` Sven Wischnowsky 2002-08-20 15:07 ` Bart Schaefer 2002-08-20 15:21 ` Sven Wischnowsky 2002-08-18 16:29 ` DervishD 2002-08-18 23:07 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox https://git.vuxu.org/mirror/zsh/ This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).