From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Florian Beck Newsgroups: gmane.emacs.help Subject: Re: Sorting Order of Completion Candidates Date: Tue, 01 Mar 2011 19:22:47 +0100 Message-ID: <4D6D3977.2060803@miszellen.de> References: <4D6BB13E.3040404@miszellen.de> <87aahevm69.fsf@lifelogs.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1299003808 8770 80.91.229.12 (1 Mar 2011 18:23:28 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 1 Mar 2011 18:23:28 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Mar 01 19:23:23 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PuUEF-00014a-D9 for geh-help-gnu-emacs@m.gmane.org; Tue, 01 Mar 2011 19:23:23 +0100 Original-Received: from localhost ([127.0.0.1]:33137 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PuUEE-0005Sl-KL for geh-help-gnu-emacs@m.gmane.org; Tue, 01 Mar 2011 13:23:22 -0500 Original-Received: from [140.186.70.92] (port=35766 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PuUDk-0005QK-51 for help-gnu-emacs@gnu.org; Tue, 01 Mar 2011 13:22:53 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PuUDj-0007oR-5Z for help-gnu-emacs@gnu.org; Tue, 01 Mar 2011 13:22:52 -0500 Original-Received: from mo-p00-ob.rzone.de ([81.169.146.161]:26423) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PuUDi-0007nw-Db for help-gnu-emacs@gnu.org; Tue, 01 Mar 2011 13:22:51 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1299003767; l=693; s=domk; d=streitblatt.de; h=Content-Transfer-Encoding:Content-Type:In-Reply-To:References: Subject:To:MIME-Version:From:Date:X-RZG-CLASS-ID:X-RZG-AUTH; bh=hmMCZuV8qh3oSiW2Tro4Trc3Gzo=; b=wNNv1K2et1mn7te+hF6zEyMn2W1VdeuYnopDnoyCHGRjYZkCh55bnqS46XAAsh3qgCe i/gCkspLl866i7eh7sOoSge/5V82RSvJoNhcmIyvY6QLHSO9mHcvh2GhVlwkQUj1f/nVG FLg9DNGubxcJ3cYR/3vnDfhSArLew3EvC2s= X-RZG-AUTH: :KmALZ0mpdbGonPxw7gDkop508XQjelhLxGYn4B74/jTNdrjLjuwMuuiy8j0BYXei76wM+Bo= X-RZG-CLASS-ID: mo00 Original-Received: from [192.168.2.100] (p54996440.dip.t-dialin.net [84.153.100.64]) by post.strato.de (fruni mo46) (RZmta 25.5) with ESMTPA id D025dfn21HpP6l for ; Tue, 1 Mar 2011 19:22:47 +0100 (MET) User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 In-Reply-To: <87aahevm69.fsf@lifelogs.com> X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 81.169.146.161 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:79648 Archived-At: On 03/01/2011 05:29 PM, Ted Zlatanov wrote: > Florian: I've proposed a patch to use the string property > :completion-score to attach a numerical score to the completion > candidates. The discussion so far is in the BBDB mailing list (where we > needed to score completion candidates) but I will propose it on > emacs-devel once Stefan reviews it. Nice idea. You mean text properties on the strings? So I would use something like (defun string-score-higher (a b) (if (> (or (get-text-property 0 :completion-score a) 0) (or (get-text-property 0 :completion-score b) 0)) a (string-lessp a b))) as a sorting predicate? Seems to work (so far), Thanks, Florian