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

Re: PATCH: 3.1.5 - (Sven) Case-insensitive globbing

: Approximate matching could either use the auto-correct code, or could
: use something like whatever agrep uses.  In the latter case, it would
: have an optional integer parameter too, so "(#a1)readme" would match
: "Readme" and "read.me", but to match "read", you'd need "(#a2)readme".


Hey!  This is getting interesting...I may be able to offer my help to
the zsh community (after a long slumber).

It so happens that I have been slowly implementing from scratch the
approximate matching algorithm(s) used in agrep.  My intention has
been to encapsulate them into a nice library.  I tried doing that from
the agrep 2.04 (the version that comes with Glimpse, not the version
at ftp.cs.arizona.edu), but that's a little bit hard: agrep as it now
stands uses dozens of global variables, is not re-entrant, has certain
hard-coded limitations, et cetera.

There are several different algorithms used in agrep: Boyer-Moore,
vanilla regexp, vanilla approximate, approximate + regexp, multistring
search.  I intend only to implement the fuzzy ones and for filename
globbing the vanilla approximate algorithm should be enough.

I am implementing the library under the Artistic License (available
from the Perl distribution) so there should be no trouble including it
into zsh, right?

Of course, if you need the approximate matching code, like, today or
tomorrow, sorry, no can do, I am rather busy with other projects.  If
I really work on it it will take couple of weeks to implement and test
(benchmark and regress-test it against agrep).


P.S.  To further confuse the issue of filename globbing: ta-dah, yet
another idea! :-) But first off: sorry if the following feature
already exists in zsh --- I haven't been following the development
(aka the feeping creaturism :-) of zsh that closely lately.

The feature: "union directories" aka "multiple working directories"
aka "virtual directories".  Instead of having just a single directory
to glob/expand filenames from, how about having several of them: "a
path of cwds".  Yes, this may be *really* confusing -- but I often
find myself at least temporarily wishing for something like that.
There are open issues like for example what to do when several
identically named files match: just take the first one / take all of
them / abort and tell that there are several possibilities / other?

$jhi++; # http://www.iki.fi/~jhi/
        # There is this special biologist word we use for 'stable'.
        # It is 'dead'. -- Jack Cohen

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