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: Emacs needs truely useful flex matching Date: Thu, 21 Mar 2013 23:02:59 +0800 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1363878195 22673 80.91.229.3 (21 Mar 2013 15:03:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 21 Mar 2013 15:03:15 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 21 16:03:39 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 1UIh1h-0001sH-3R for ged-emacs-devel@m.gmane.org; Thu, 21 Mar 2013 16:03:33 +0100 Original-Received: from localhost ([::1]:38743 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIh1J-0003jW-KU for ged-emacs-devel@m.gmane.org; Thu, 21 Mar 2013 11:03:09 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:47799) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIh1E-0003iC-8C for emacs-devel@gnu.org; Thu, 21 Mar 2013 11:03:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIh1B-0004QS-5Q for emacs-devel@gnu.org; Thu, 21 Mar 2013 11:03:04 -0400 Original-Received: from mail-wg0-f50.google.com ([74.125.82.50]:49286) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIh1A-0004OM-Um for emacs-devel@gnu.org; Thu, 21 Mar 2013 11:03:01 -0400 Original-Received: by mail-wg0-f50.google.com with SMTP id es5so69848wgb.29 for ; Thu, 21 Mar 2013 08:02:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type; bh=bbBsssyPpRQEk/CNm7Dmn0oU3jXVUA6WiInjnu701ag=; b=B9vS3XALLsD++AVOOreEjFl6kZ0qxgALf+flzq4WJDKhA8/TZoNM1sFzgXBZh2a40J sKmdmO9Elwa2wlPwJ3l1/kLunPaYML0fhKOruDEWH2rlPsSo9zIGDdory2F0EX2CUlSp T1/gF9otyPkrk9+pe5krGXOWbzMfTw3F5l0X2OazJRN0TnGahS2NfysYxBJVX0HTRG2H JDQDAn7Th+RTooJY/KkMbtW9hspfIgCuq5reetalUA2XWLtJMTyyb3emFo8sk9ZA1Z4d ra974oe5n8Du90Xctl1sS/VDoYZsqXMY0BmXODDukrir79uxJ/6zlB8URqCpwoNKNge/ khQg== X-Received: by 10.180.10.105 with SMTP id h9mr5264057wib.34.1363878179267; Thu, 21 Mar 2013 08:02:59 -0700 (PDT) Original-Received: by 10.216.122.74 with HTTP; Thu, 21 Mar 2013 08:02:59 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 74.125.82.50 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:158032 Archived-At: Hi all, Since there is a big thread about a standard way to recognise project roots, 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 through 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 Emacs. 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. 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. -- Le