From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3521 invoked from network); 16 Jan 1998 15:35:33 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 16 Jan 1998 15:35:33 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id KAA22077; Fri, 16 Jan 1998 10:22:21 -0500 (EST) Resent-Date: Fri, 16 Jan 1998 10:22:21 -0500 (EST) Date: Fri, 16 Jan 1998 18:24:16 +0300 (MSK) From: Andrej Borsenkow X-Sender: bor@itsrm1 Reply-To: borsenkow.msk@sni.de To: pws@ibmth.difi.unipi.it cc: Zsh hackers list Subject: Re: PATCH: 3.1.2-zefram3: history completion In-Reply-To: <9801161052.AA45436@ibmth.difi.unipi.it> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Resent-Message-ID: <"klF0d2.0.uO5.iitlq"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3723 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu I like the idea, but I totally disagree with implementation (sorry). It continues the trend to add to base ZSH every feature someone finds to be useful. I strongly believe, that base zsh must provide general enough tools to do such sort of things in user space (or as separate module if anybody will suffer from performance). Speaking about completion - it should really be redefined to provide - completion pure It must deal with actual completion in the sense of building list of possible matches for a given line. There must exist interface on source level (for possible use in modules) and in user space (for use with user defined widgets). - anything else really belongs to ZLE. After I have list of matches, the way they are presented (menu, list or anything else) has nothing to do with completion per se. It also would provide a nice way to do selection from user-defined lists (some thing I did miss - you cannot defined "context independent" completion. E.g. it doesn't make sense to define *all* command which use user name as argument - but if I had a way to say "select from user list" I could bind it and use with any command). ZLE should probably provide general purpose widget(s) for selection from given list (a la existing menu/list/beep completion). Assuming, that zcomplete does completion returning possible matches and zle-select-from-list provides user interface to select from matches array, the whole story would look like function history-complete-word () { set -A matches $(zcomplete \ -l $BUFFER <= current line -c $CURSOR <= current position -r '-s "$(fc -l 1 -1 | sed \"s/^[WS TAB]*[0-9]*[WS TAB]*//\")"' \ ^^^^ actual completion rules (take words from history and select matching ones) ) zle zle-select-from-list ^^^ takes over TAB if menu completion desired } zle -N history-complete-word history-complete-word bindkey '\M-/' history-complete-word (sed is needed only to strip history numbers). I hope, the idea is not completely insane ... ------------------------------------------------------------------------- Andrej Borsenkow Fax: +7 (095) 252 01 05 SNI ITS Moscow Tel: +7 (095) 252 13 88 NERV: borsenkow.msk E-Mail: borsenkow.msk@sni.de -------------------------------------------------------------------------