zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@ifh.de>
To: zsh-workers@math.gatech.edu (Zsh hackers list)
Subject: Re: zsh-equivalent for tcsh option "set complete=enhance"?
Date: Tue, 11 Mar 1997 18:19:55 +0100	[thread overview]
Message-ID: <199703111719.SAA27160@hydra.ifh.de> (raw)
In-Reply-To: "Zoltan Hidvegi"'s message of "Wed, 05 Mar 1997 22:22:41 MET." <199703052122.WAA31454@bolyai.cs.elte.hu>

Zoltan Hidvegi wrote:
> >From wischnow@informatik.hu-berlin.de  Thu Oct 31 13:06:39 1996
> Because of that I won't be able to port the patch below to a newer
> version, so I'm sending it for 2.6beta19 (sorry).
> 
> It contains some thing I was playing with for some years now, in
> short:
> 
> - Completion character equivalence classes: some characters can stand
>   for others when completing (e.g. `-' can stand for `-' and `_'),
>   this is under complete user control.
> - An option to make completion case-insensitive.

I thought about this and (although I don't myself writing it without
several years more experience in the relevant code) I don't see why it
shouldn't be a little more general and in some sense zsh-like.

What I had in mind was that instead of using global arrays there is an
extra option to compctl (say -M for modify match) that says what can
be done to the command argument to make it match the candidate.  For
example,

-M 'c,E[[-_],],e[no,],E[\?,[A-Za-z]]'

says:

- this completion is to be performed with case-fold search (you'll see
this is the same as E[[A-Za-z],[A-Za-z]], but this is probably common
enough for a shorthand)

- any _ or - in the argument matches the empty string in the candidate
(and hence should be discarded) --- E specifies pattern matching

- likewise, the string 'no' is to be replaced with an empty one; (e
for a string; the e/E distinction is like extended completion) [this
replaces all no's, not just at the beginning, haven't thought what to
do about that]

- a real ? (because quoted) in the argument is equivalent to a single
alphabetic character in the candidate.

So, with the above

setopt no_SH_WO?D_SP<TAB>   ->    no_SH_WO?D_SPlit
                                          ^ not actually any use,
                                            just an example

Maybe a general pattern behaviour like this is too difficult and it
needs instead to involve character classes and strings instead.  I've
really no idea whether this double pattern matching is feasible in an
efficient fashion.  In fact, this is obviously going to be a lot
slower than Sven's proposal, although one only gets the overhead when
one needs it.

-- 
Peter Stephenson <pws@ifh.de>       Tel: +49 33762 77366
WWW:  http://www.ifh.de/~pws/       Fax: +49 33762 77413
Deutsches Elektronen-Synchrotron --- Institut fuer Hochenergiephysik Zeuthen
DESY-IfH, 15735 Zeuthen, Germany.


  reply	other threads:[~1997-03-11 17:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-03-05 21:22 Zoltan Hidvegi
1997-03-11 17:19 ` Peter Stephenson [this message]
  -- strict thread matches above, loose matches on Subject: below --
1997-03-15 12:09 Sven Wischnowsky
1997-03-05 20:45 Armin Fessler

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=199703111719.SAA27160@hydra.ifh.de \
    --to=pws@ifh.de \
    --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).