From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13855 invoked from network); 27 Apr 2000 06:51:01 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 27 Apr 2000 06:51:01 -0000 Received: (qmail 6314 invoked by alias); 27 Apr 2000 06:50:49 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 10951 Received: (qmail 6300 invoked from network); 27 Apr 2000 06:50:48 -0000 Message-ID: <20000427065004.6665.qmail@web1303.mail.yahoo.com> Date: Wed, 26 Apr 2000 23:50:04 -0700 (PDT) From: Felix Rosencrantz Subject: Re: Proposed _history completer To: zsh-workers MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii I'm not currently doing any work on the _history completer. So if you want to commit the changes that would be fine with me. Though I think my testing is pretty limited (e.g. I don't use NUMERIC arguments, and I didn't try various zstyle configurations.) I was thinking that in case there were any obvious problems with the completer (e.g. _wanted shouldn't be used in a completer) someone would post that feedback. Also, I don't have a lot of time to work on it, this completer has been on my list for a while. So if other people want work on it I would be happy. Sven Wischnowsky wrote: >_first contains a bit of code for something like this... It's not quite N number of lines back that the compctl uses, but it seems like a reasonable approximation. >> I think there is a lot of potential to be found in limiting history words to >> similar contexts; only history lines where the current command is used, >> or previous values for the current option. > >Sounds good. > >> To do this might require >> some changes to the zsh/parameter module to make this efficient. > >Hm, I can't see how this could be done, yet. Have you tried how >slow/fast it is? I wasn't sure how to break up the values of $history to find the start of commands, and to break up along word boundaries. I was thinking that we might need C code support for that. The $historywords array gives us the words, but it doesn't give much context (e.g. like if the word is in a command position, what history line the command is from). Here is a quick test I tried to see where words are broken for $history and $historywords: prompt% echo "this is long string" `echo this is a cmd string | cat -n ` this is long string 1 this is a cmd string prompt% ~/bin/args $historywords 0. $historywords 1. ~/bin/args 2. `echo this is a cmd string | cat -n ` 3. "this is long string" 4. echo prompt% ~/bin/args $history 0. ~/bin/args $historywords 1. echo "this is long string" `echo this is a cmd string | cat -n ` In this instance, how do we find the words supplied to various echo commands or the cat command. How do we find that cat is command here. I'm not sure how easy this is to do in a zsh script. Even if we had that information, I was thinking it might be more efficient to have the zsh/parameter module prune what is actually put into these special history parameters. Prune might limit the lines/words to only those of specific commands, or within the last so many lines of history. But I'm not sure how we would specify what is pruned, if we wanted to do that. I tend to have a large history buffer, so I always worry about what resources those arrays are using. >> It might be useful to use history as a way to filter completions from other >> completers. To first use completions that are already found in history. >> Or the opposite, to eliminate choices that are found in the history. > >Hm, the latter sounds more useful. That could probably be done with >some trickery with _comp_ignore, which is set in _description, but the >history stuff probably shouldn't go there. Maybe another completer >that sets some array and a change to _description to include >that. Might make things pretty slow, but there may be potential for >optimisation... probably an option to compadd like -F but that gives >strings (not patterns) to exclude. Or maybe just make -F use strings >without wildcards directly in a strcmp(). You've gone beyond my understanding of the completion system. Would require more studying on my part to be clear about what you are proposing. -FR __________________________________________________ Do You Yahoo!? Talk to your friends online and get email alerts with Yahoo! Messenger. http://im.yahoo.com/