Zsh Mailing List Archive
Messages sorted by:
Re: PATCH: short-circuiting glob exclusion operator
On Mon, 21 Mar 2016 15:54:21 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Mar 21, 6:36pm, Peter Stephenson wrote:
> } This is a request for comments for now. I'm not yet entirely sure the
> } pattern syntax with two tildes isn't going to cause problems (though I
> } don't see what they would be), or that I've identified all the side
> } effects that can happen.
> As Mikael has already pointed out, files with names ending in a tilde
> followed by an exclusion pattern may cause trouble with this.
Yes, they do: the logic was that if it saw "~~" in the middle, the first
"~" couldn't be an exclusion, because there was nothing after it other
than another "~" (exclusions have to be non-empty patterns), so it was
treated as quoted. This would change.
~# might work instead.
> } As an ultra brief summary, ~~ in a glob introduces a pattern that will
> } prune directories on the way through in addition to acting in the normal
> } exclusion fashion.
> I don't suppose it would instead be possible to special-case something at
> the END of the pattern? E.g. **/*~*/foo/** where the trailing /** means
> to prune at whatever precedes it.
That's quite hard to parse; you're happily looking at a normal "~" and
then you find right at the end that actually it doesn't belong within
the pattern at all, instead it belongs higher up with the hierarchy of
file patterns (although ~ is already hacked a bit to apply to the whole
pattern in ways I haven't quite got to the bottom of again).
What worries me most is pat~foo~bar is supposed to exclude both
foo and bar, and I'm not sure how that could fit in here.
> I suppose that conflicts with the new GLOB_STAR_SHORT option, although
> ultimately it means exactly the same in context.
It doesn't, really, since directories aren't specially handled after the
~, or could in principle be specially handled by different means.
> Aside: Do we really want to add this before we've figured out the
> background for "Extended globbing seems to have become much slower"?
No hurry, but I have no idea where that's going and we already seem to
have excluded most of the things we know about...
Messages sorted by: