From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8493 invoked from network); 14 Jul 2000 07:23:06 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 14 Jul 2000 07:23:06 -0000 Received: (qmail 29948 invoked by alias); 14 Jul 2000 07:22:47 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 12251 Received: (qmail 29941 invoked from network); 14 Jul 2000 07:22:46 -0000 Date: Fri, 14 Jul 2000 09:22:44 +0200 (MET DST) Message-Id: <200007140722.JAA01233@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Felix Rosencrantz's message of Thu, 13 Jul 2000 21:46:12 -0700 (PDT) Subject: Re: ZLE Widget: Insert last word (except &) Felix Rosencrantz wrote: > Talking about context and the "z" expansion flag. It would be useful > if it was possible to somehow get context information about the words > that were created. > > For example, if a word is > in the command position > a command separator > an opening or closing syntax character > the output/input to redirection. > parameter assignment (e.g. before a command) > etc. > > I think it be useful if it was possible to get another array that provided > information/context about each of the words from an array created via ${(z)..} It would definetely be useful, but it's not trivial. See the function zle_tricky.c:get_comp_string(). That plus the code to find out the information for every word. However: one of the things I want to try after 4.0 is moving more of ZLE into shell code (optionally, as for completion). One of the things on my list is the C-code for completion, probably with a small new builtin for the pre- and post-widget code, but partly in shell code. The pre-code would allow to parse a string as if it were the command line and would return all the information completion widgets get in the special parameters. I hadn't thought about doing this by moving some code into the core and adding a new parameter expansion, though. I'm not sure where the code would end up anyway, because parts of it wouldn't depend on the completion code, so they may be moved to zutil or something. Well, and that combined with a change to the completion system which can be used to generate the context without generating completions... > ... > > Or in the history completer/widget having context information would make it > a lot easier to look at command line structure, and prune away things that > are unwanted, or make it easier to find things that are useful. That sounds terribly slow ;-) Bye Sven -- Sven Wischnowsky wischnow@informatik.hu-berlin.de