From: Le Wang <l26wang@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: "Óscar Fuentes" <ofv@wanadoo.es>, emacs-devel@gnu.org
Subject: Re: Emacs needs truely useful flex matching
Date: Fri, 22 Mar 2013 09:00:14 +0800 [thread overview]
Message-ID: <CAM=K+iprKKQx0sqvxwDxpd65rKcs1=WfsLSDfuBkppvZ7qnofA@mail.gmail.com> (raw)
In-Reply-To: <jwvwqt0wbvh.fsf-monnier+emacs@gnu.org>
On Fri, Mar 22, 2013 at 7:58 AM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
>>> The sorting algorithm is roughly this for a query: "abcd"
>>>
>>> 1. Get all matches for "a.*b.*c.*c"
>>> 2. Calculate score of each match
>>> - contiguous matched chars gets a boost
>>> - matches at word and camelCase boundaries (abbreviation) get a boost
>>> - matches with smallest starting index gets a boost
>>> 2. Sort list according to score.
>
> I think that if you turn "abcd" into a regexp of the form
> "\\(\\<\\)?a\\([^b]*\\)\\(\\<\\)?b\\([^c]*\\)\\(\\<\\)?c\\([^d]*\\)\\(\\<\\)?d"
> the regexp matching should be fairly efficient and you should be able to
> compute the score efficiently as well (at least if
> you ignore the camelCase boundaries).
I hadn't thought of this, and I'll try it soon.
> Have you tried such an approach and it really was too slow?
> I'd welcome a new completion-style using the above flex matching.
You're right that in generally that my claim of "emacs-lisp would be
too slow" needs to be verified.
>> IIUC the vim plugin you mention depends on a pre-built list of files.
>
> Indeed when searching for a file in a file hierarchy, you'd need
> a pre-built list of files, otherwise the time taken to find the files
> would dwarf the flex-matching time in any case.
"git ls-files" is very fast on a solid state drive, and the list can
also be cached. But let's assume we already have the list of strings.
--
Le
next prev parent reply other threads:[~2013-03-22 1:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-21 15:02 Emacs needs truely useful flex matching Le Wang
2013-03-21 17:49 ` Óscar Fuentes
2013-03-21 23:34 ` Le Wang
2013-03-21 23:58 ` Stefan Monnier
2013-03-22 1:00 ` Le Wang [this message]
2013-03-22 8:24 ` Eli Zaretskii
2013-03-22 11:18 ` Dmitry Gutov
2013-04-14 16:48 ` Le Wang
2013-04-14 18:18 ` Stefan Monnier
2013-04-15 0:14 ` Le Wang
2013-04-15 13:50 ` Stefan Monnier
2013-03-22 2:36 ` Richard Stallman
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAM=K+iprKKQx0sqvxwDxpd65rKcs1=WfsLSDfuBkppvZ7qnofA@mail.gmail.com' \
--to=l26wang@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
--cc=ofv@wanadoo.es \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.