From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Le Wang Newsgroups: gmane.emacs.devel Subject: Re: Emacs needs truely useful flex matching Date: Fri, 22 Mar 2013 07:34:07 +0800 Message-ID: References: <877gl0od6x.fsf@wanadoo.es> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1363908875 25195 80.91.229.3 (21 Mar 2013 23:34:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 21 Mar 2013 23:34:35 +0000 (UTC) Cc: emacs-devel@gnu.org To: =?ISO-8859-1?Q?=D3scar_Fuentes?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 22 00:34:58 2013 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UIp0a-0003MV-Ej for ged-emacs-devel@m.gmane.org; Fri, 22 Mar 2013 00:34:56 +0100 Original-Received: from localhost ([::1]:46393 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIp0C-0004bJ-O7 for ged-emacs-devel@m.gmane.org; Thu, 21 Mar 2013 19:34:32 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:51717) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIp05-0004aG-75 for emacs-devel@gnu.org; Thu, 21 Mar 2013 19:34:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIozz-0004Un-Va for emacs-devel@gnu.org; Thu, 21 Mar 2013 19:34:25 -0400 Original-Received: from mail-wg0-x229.google.com ([2a00:1450:400c:c00::229]:54185) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIozz-0004Uf-Oy for emacs-devel@gnu.org; Thu, 21 Mar 2013 19:34:19 -0400 Original-Received: by mail-wg0-f41.google.com with SMTP id ds1so2333089wgb.0 for ; Thu, 21 Mar 2013 16:34:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding; bh=UjaCEHV2gP66b4ngknuV2I/lVQLOa26YrJMEzQ9igV8=; b=EvfFbwOAe9jmSBe7IgwJmQdoNooNrASzkFbt5UMiSubW/YM6OxNIIlY3N5MuGwJf7K fwRp3hum6YZHMF4gDO1MFa2Z/TgJwIGTYTdilzakvXM+6vUT7INbWnw1rZvcmvEHNfp9 Pmve+PgQ4O2jMISfxbvx5FcRtflg+N4dXGpeT24UOMh5SGfxZxv9ESRNjlQXbhnWgQ/I Vh+WYU/A2Z466o36QP9ko47WBJ9Yva+0Yj5ZWIn2IKJtcowYF9KT/YyScP87lGUIp56C n+c8R+iMKnCZVy0+ObUDGckbKtSSRV3A66w6grM/GUeSBskr0RdEetj6VClOim8SK4g1 vEwQ== X-Received: by 10.180.84.162 with SMTP id a2mr7638165wiz.14.1363908847316; Thu, 21 Mar 2013 16:34:07 -0700 (PDT) Original-Received: by 10.217.116.8 with HTTP; Thu, 21 Mar 2013 16:34:07 -0700 (PDT) In-Reply-To: <877gl0od6x.fsf@wanadoo.es> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c00::229 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:158041 Archived-At: On Fri, Mar 22, 2013 at 1:49 AM, =D3scar Fuentes wrote: > Le Wang writes: > >> Since there is a big thread about a standard way to recognise project ro= ots, I >> want to bring up another area in which Emacs is falling behind other >> Editors (Sublime Text, Textmate, and Vim). >> Choosing from a very large list of files (or any strings for that matter= ) with >> a minimum of keystrokes. >> >> ido-mode has `ido-enable-flex-matching', but that does not do the smart >> sorting required. >> >> Vim has this through the Command-T plugin. The best way to "get it" is = by >> watching it in action: >> https://s3.amazonaws.com/s3.wincent.com/command-t/screencasts/command-t-= demo.mov >> >> Skip to 6 minutes to see it in action in a large project with >> repetitive path segments. >> >> Homepage here: https://wincent.com/products/command-t >> >> The matching engine is implemented in C and it interfaces with Vim throu= gh the >> Ruby bridge. I think in order to sort a large list of strings (> 10k), = this >> will also have to be implemented in C to be fast enough if done for Emac= s. >> >> 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 boos= t >> - matches with smallest starting index gets a boost >> 2. Sort list according to score. >> >> A lot of my colleagues use this kind of flex matching to navigate around= our >> large code base in Sublime Text and I'm very jealous that with so few >> keystrokes the most useful >> matches just float to the top. >> >> This navigation could be implemented with Helm if Emacs had a builtin >> fast smart flex sorting engine. > > IIUC the vim plugin you mention depends on a pre-built list of files. In > that regard, how is it better than GNU Global, which allows to search > files with a regex (and much more)? Maybe the algorithm you describe > can be implemented on GNU Global and then use an Emacs interface. The type of smart matching + sorting would be useful for files, M-x, C-h v, all kinds of completion where large lists are involved. GNU globals maybe should support it, but Emacs shouldn't depend on external dependency to offer something this useful. > I agree that it would be nice to have such a feature native on Emacs, > though. IIRC someone mentioned a few days ago that a regex of the type > you descibe has very high execution complexity (-> is slow) That is true, and speed is of the utmost essence, so emacs-lisp is probably too slow. > but obviously it is working for that vim extension. Textmate has had this for a while, and I see Sublime Text do it very well every day, of course. :( These editors are moving the ball for what people expect a modern editor to provide. Honestly when I first tried `ido-enable-flex-matchine', I thought it was strange, So it's entirely possible I haven't made the strongest case for the usefulness of this feature. Please let me know if you aren't convinced.. --=20 Le