zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: RE: Matching against file suffix
Date: Thu, 9 Mar 2000 16:07:45 +0100 (MET)	[thread overview]
Message-ID: <200003091507.QAA30731@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Andrej Borsenkow"'s message of Thu, 9 Mar 2000 16:41:51 +0300


Andrej Borsenkow wrote:

> > The simple 'r:|.=* r:|=*' works for me, i.e. `foo .../.texi<TAB>'
> > gives me the *.texi files.
> >
> 
> Well, I never could completely grok matchers :-)
> 
> Still, it seems, that with above matcher zsh considers only first dot. E.g.
> 
> zstyle ':completion:*:*:files' matcher 'r:|.=* r:|=*'
> bor@itsrm2% l
> WinNT/                    patches/                  zsh-3.1.6-dev-15.tar.gz
> zsh-3.1.6-dev-16.tar.gz   zsh-3.1.6-dev-17.tar.gz   zsh-3.1.6-dev-18.tar.gz
> zsh-3.1.6-dev-19.tar.gz   zsh-3.1.6.tar.gz
> bor@itsrm2% l .gz<TAB>
> 	beeps, but
> bor@itsrm2% l .1<TAB>
> bor@itsrm2% l zsh-3.1.6.tar.gz
> Completing file
> zsh-3.1.6-dev-15.tar.gz   zsh-3.1.6-dev-16.tar.gz   zsh-3.1.6-dev-17.tar.gz
> zsh-3.1.6-dev-18.tar.gz   zsh-3.1.6-dev-19.tar.gz   zsh-3.1.6.tar.gz
> 
> I vaguelly remember, that it was once done on purpose. While I agree, that it may be
> useful at times - is it possible to have alternate way that matches separators as well? Or
> some other way to get the above?

Urgh. We had so many problems with that, that I would prefer to not
change (or enhance) it again. Hm, a pure suffix test match spec would
be `l:|=*' (read: there may be any characters before the word typed).

[ Btw. tcsh with complete=enhance does the same -- by which I don't
  want to say that it is the correct behaviour. ;-]

And...

> In the above case I'd like being able to say
> 
> gzcat -19TAB (or even -6-19)
> and get it expanded to zsh-3.1.6-dev-19.tar.gz

this (the `-19<TAB>', not the `-6-19<TAB>') is exactly what I use the
substring-matcher for: `l:|=* r:|=*' means that there may be any
characetrs before or after the word from the line.

> > Btw, I have the _match completer in my completer style, but only after
> > all the matcher-list specs have been tried (which include the one
> > above and the substring-matcher `l:|=* r:|=*').
> 
> That reminds me. Matcher-list is way too general - it applies to any completion in any
> context. And matcher is tried unconditionally, isn't it?

I'm not sure what you mean by `unconditionally' -- I always consider
the context for which it is set to be a `condition'.

> Is there any feasible way to add
> per-tag matcher-list? So, that one could say
> 
> *files matcher-list ...

I've been dreaming about this, too. But -- as you can see -- I didn't
find a solution. There are actually two problems:

- Testing multiple patterns would require a loop somewhere. Since
  nobody will suggest that every completion function should implement
  such a loop, we could put it in compadd (i.e. in C-code). We would
  then need another option to give it a bunch of match specs to try
  one after another. That's not too hard. But:
- The second problem is to decide when to try the next pattern.
  Consider a context where we can add more than one type of
  matches. Here we almost certainly first want to try all types with
  the first match spec, then try all types with the next pattern and
  so on. In other words: we can write the loop only in the completion
  functions. Even worse: only in the top-level functions. And now
  think about functions like _users which are sometimes called as
  top-level functions and sometimes as utility functions. And we can't 
  put the loop(s) in a function further up (like _normal), because we
  don't know about the tags there.

Sigh.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


             reply	other threads:[~2000-03-09 15:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-09 15:07 Sven Wischnowsky [this message]
2000-03-10  9:57 ` Andrej Borsenkow
  -- strict thread matches above, loose matches on Subject: below --
2000-03-13 10:13 Sven Wischnowsky
2000-03-10 10:27 Sven Wischnowsky
2000-03-10 11:04 ` Andrej Borsenkow
2000-03-09 12:42 Sven Wischnowsky
2000-03-09 13:41 ` Andrej Borsenkow
2000-03-09 10:36 Andrej Borsenkow

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=200003091507.QAA30731@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /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).