From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Emacs needs truely useful flex matching Date: Thu, 21 Mar 2013 19:58:11 -0400 Message-ID: References: <877gl0od6x.fsf@wanadoo.es> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1363910298 5713 80.91.229.3 (21 Mar 2013 23:58:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 21 Mar 2013 23:58:18 +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:58:44 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 1UIpNY-0001Ho-FG for ged-emacs-devel@m.gmane.org; Fri, 22 Mar 2013 00:58:40 +0100 Original-Received: from localhost ([::1]:53315 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIpNA-00035r-KU for ged-emacs-devel@m.gmane.org; Thu, 21 Mar 2013 19:58:16 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:56789) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIpN7-00035i-PB for emacs-devel@gnu.org; Thu, 21 Mar 2013 19:58:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIpN6-00040b-SF for emacs-devel@gnu.org; Thu, 21 Mar 2013 19:58:13 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:2890) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIpN6-00040V-OL for emacs-devel@gnu.org; Thu, 21 Mar 2013 19:58:12 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFFxKvA/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOkeoFegxM X-IPAS-Result: Av4EABK/CFFFxKvA/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOkeoFegxM X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="5496945" Original-Received: from 69-196-171-192.dsl.teksavvy.com (HELO pastel.home) ([69.196.171.192]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 21 Mar 2013 19:58:09 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 6771967AC3; Thu, 21 Mar 2013 19:58:11 -0400 (EDT) In-Reply-To: <877gl0od6x.fsf@wanadoo.es> (=?iso-8859-1?Q?=22=D3scar?= Fuentes"'s message of "Thu, 21 Mar 2013 18:49:42 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.182 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:158045 Archived-At: >> 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). >> This navigation could be implemented with Helm if Emacs had a builtin >> fast smart flex sorting engine. Have you tried such an approach and it really was too slow? I'd welcome a new completion-style using the above flex matching. > 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. Stefan