zsh-workers
 help / color / mirror / code / Atom feed
From: Andrej Borsenkow <borsenkow.msk@sni.de>
To: pws@ibmth.difi.unipi.it
Cc: Zsh hackers list <zsh-workers@math.gatech.edu>
Subject: Re: PATCH: 3.1.2-zefram3: history completion
Date: Fri, 16 Jan 1998 18:24:16 +0300 (MSK)	[thread overview]
Message-ID: <Pine.SV4.3.95.980116173358.16351F-100000@itsrm1> (raw)
In-Reply-To: <9801161052.AA45436@ibmth.difi.unipi.it>

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
-------------------------------------------------------------------------







  reply	other threads:[~1998-01-16 15:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-01-16 10:52 pws
1998-01-16 15:24 ` Andrej Borsenkow [this message]
1998-01-16 16:02   ` Peter Stephenson
1998-01-16 16:57     ` Bruce Stephens
1998-01-16 17:26       ` Andrew Main

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.SV4.3.95.980116173358.16351F-100000@itsrm1 \
    --to=borsenkow.msk@sni.de \
    --cc=pws@ibmth.difi.unipi.it \
    --cc=zsh-workers@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).