unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: "tomas@tuxteam.de" <tomas@tuxteam.de>
Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: RE: [External] : Re: How to grep for a string spanning multiple lines?
Date: Mon, 28 Nov 2022 06:17:25 +0000	[thread overview]
Message-ID: <SJ0PR10MB54881AE51E43AAC095F29539F3139@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <Y4RCIlG9nTgX6c7u@tuxteam.de>

> > (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	other threads:[~2022-11-28  6:17 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-26  6:42 How to grep for a string spanning multiple lines? Marcin Borkowski
2022-11-26  8:27 ` Jean Louis
2022-11-26  8:36 ` tomas
2022-11-26  8:43   ` Jean Louis
2022-11-26  8:59     ` Eli Zaretskii
2022-11-26  9:06       ` Jean Louis
2022-11-27  7:31         ` Michael Heerdegen
2022-11-27  7:44           ` Jean Louis
2022-11-27 12:04             ` Michael Heerdegen
2022-11-27 18:25               ` Jean Louis
2022-11-26 10:57 ` Arthur Miller
2022-11-26 14:55 ` Emanuel Berg
2022-11-27  6:54   ` Marcin Borkowski
2022-11-27  7:26     ` Jean Louis
2022-11-27 13:48     ` Emanuel Berg
2022-11-27 18:10       ` tomas
2022-11-27 19:04         ` Emanuel Berg
2022-11-27 19:46         ` [External] : " Drew Adams
2022-11-28  5:07           ` tomas
2022-11-28  6:17             ` Drew Adams [this message]
2022-11-29  2:00               ` Emanuel Berg
2022-11-28 21:05             ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-11-28 21:12               ` Emanuel Berg
2022-11-28 21:17               ` Emanuel Berg
2022-12-04 21:55 ` Rudolf Adamkovič
2022-12-05 23:06   ` Emanuel Berg

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SJ0PR10MB54881AE51E43AAC095F29539F3139@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=tomas@tuxteam.de \
    /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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).