help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [External] : Re: How to grep for a string spanning multiple lines?


From: Drew Adams
Subject: RE: [External] : Re: How to grep for a string spanning multiple lines?
Date: Mon, 28 Nov 2022 06:17:25 +0000

> > (FYI2: Icicles uses that library, if you have it:
> 
> (why not the built-in [`string-difference']?
> Did it came later, or is it less useful?)

Icicles has had Levenshtein "fuzzy" matching
since 2009.  I just use the `levenshtein.el'
function `levenshtein-distance'.  No doubt
`string-distance' could now be used instead.
___

As the Icicles doc says, for most purposes,
Levenshtein matching isn't all that useful
for completion, IMO.  See the URL I pointed to:

https://www.emacswiki.org/emacs/Icicles_-_Completion_Methods_and_Styles#LevenshteinCompletion

First, incremental completion (rematching
each time you type or delete a char) is
important to using Icicles, and ordinary
Levenshtein matching against completion
candidates is often too slow for that.

Comparing, not string1 vs string2 (a "strict"
match), but string1 vs substrings of string2,
is quicker.  But even such non-strict
Levenshtein matching can be too slow.  (You
can switch between strict and non-strict on
the fly, while completing.)

What's often most useful is matching only
within 1 Levenshtein unit (a 1-char change),
testing that with a regexp that matches
strings at most one unit from substrings of
the target string.

For this reason, the default value of option
`icicle-levenshtein-distance' is 1.  A string
matches another if the first is within this
distance of the second (if strict) or of some
substring of the second (if non-strict).

Icicles provides seven kinds of "fuzzy"
matching, which you can switch to on the
fly, but I personally don't think fuzzy
matching is so useful for completion, in
general.

https://www.emacswiki.org/emacs/Icicles_-_Completion_Methods_and_Styles

reply via email to

[Prev in Thread] Current Thread [Next in Thread]