Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

RE: PATCH: (was Re: _configure does not work)



Andrej Borsenkow wrote:

> > > itsrm2% ./configure --e-d<TAB>
> > > itsrm2% ./configure
> > >  (the whole stuff deleted)
> > >
> > > I'd thought, it completed to at least --enable-dynamic before.
> >
> > I think it didn't, I think it generated a list containing
> > `--enable-dynamic', `--enable-zsh-debug' and others. This was wrong in
> > the matching code in zle_tricky.c.
> >
> 
> Why? I had impression, it was the result of matcher. If I say -M 'r:|-=*
> r:|=*', then ``--e-d'' inevitably matches enable-zsh-debug. Should it not be
> handled in matcher spec? "anything except -"?

This is slightly modeled after globbing behavior: anchors of `*'
patterns separate parts like slashes separate pathname components.
Inside the word they all have to be typed explicitly.

Personally, I like this behavior much better than the `* matches even 
it's anchors' (I wanted this behavior from the beginning, so I
consider the patch to be a bug fix), because an important goal of
completion is to produce as few matches as possible -- even if this
may sound strange.

About making match specs more powerful: with the code as it is now, it 
would be easier to support a pattern for `match a couple of characters 
like ...', where the `...' is a character or character-class. However, 
implementing full support for `r:|.=[^.]#' would be very complicated,
since people would immediatly expect all the patterns they know from
globbing to be understood. The problem is that the code not only has
to do matching (that would be easy, just use the globbing code), but
also to build the strings to put in the line and in the match-structure.

So, I'll think about this some more once I have done the things I want 
to do in the matching/joining code anyway. But probably I would just
prefer a simple yse/no choice: a `*' that matches it's anchors and one 
that doesn't do that.

Of course, I'd also like to hear other people's opinion on this --
that would also give me a hint how many of you use such patterns.

Bye
 Sven

P.S.: To get the previous behavior, just de-apply the first two hunks
      of the patch to zle_tricky.c.

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author