From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?=C3=98yvind?= Stegard Subject: [PATCH] org-contacts: Provide ordering when using cycle completion Date: Mon, 10 Jun 2013 11:29:13 +0200 Message-ID: <87mwqy48ly.fsf.rednorrock@ifi.uio.no> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58534) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UlyPm-00025U-91 for emacs-orgmode@gnu.org; Mon, 10 Jun 2013 05:29:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UlyPe-0002nP-17 for emacs-orgmode@gnu.org; Mon, 10 Jun 2013 05:29:26 -0400 Received: from mail-out4.uio.no ([129.240.10.15]:34590) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UlyPd-0002nE-M6 for emacs-orgmode@gnu.org; Mon, 10 Jun 2013 05:29:17 -0400 Received: from mail-mx4.uio.no ([129.240.10.45]) by mail-out4.uio.no with esmtp (Exim 4.80.1) (envelope-from ) id 1UlyPa-0003ul-JV for emacs-orgmode@gnu.org; Mon, 10 Jun 2013 11:29:14 +0200 Received: from 80.109-247-247.customer.lyse.net ([109.247.247.80] helo=rednorrock.local) by mail-mx4.uio.no with esmtpsa (TLSv1.2:DHE-RSA-AES128-SHA:128) user oyvinst (Exim 4.80) (envelope-from ) id 1UlyPa-0002jB-2W for emacs-orgmode@gnu.org; Mon, 10 Jun 2013 11:29:14 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hello list, I have recently switched to using org-contacts, after several years of BBDB usage. When completing contacts in message-mode, I prefer cycling the completion alternatives, for instance when a single contact has multiple email addresses. So I set `completion-cycle-threshold' to some value other than nil. However, the cycle ordering was not consistent with the order in which email addresses appeared in the contact (actually, cycle order was shortest candidate first, which I understand is a default). So the "preferred" email address (or the first one defined in :EMAIL: property of contact node) was typically not always chosen as first completion suggestion in the cycle. I attach a patch here (against current org-mode git) which also provides the display sort function for cycle completions in metadata. That seems to resolve the problem for me. Regards, =C3=98yvind Stegard --=20 < =C3=98yvind Stegard < http://stegard.net/ --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-org-contacts-Provide-ordering-when-using-cycle-compl.patch Content-Description: [PATCH] org-contacts: Provide ordering when using cycle completion >From 64623274f0a040c452df43b2a3f7b23b0af8fd57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Stegard?= Date: Mon, 10 Jun 2013 11:08:56 +0200 Subject: [PATCH] org-contacts: Provide ordering when using cycle completion * contrib/lisp/org-contacts.el (org-contacts-metadata-prefix): Provide same function for cycle ordering as is used for display ordering in completion metadata. When using cycle completion style for contacts, by setting `completion-cycle-threshold' to some value, the ordering was not consistent with order of email addresses in contact definition, nor the order which was used for regular display completion. Fix that by also supplying sort function for cycle completion in metadata. --- contrib/lisp/org-contacts.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el index 5d63fcc..71f7bf4 100644 --- a/contrib/lisp/org-contacts.el +++ b/contrib/lisp/org-contacts.el @@ -452,7 +452,8 @@ prefixes rather than just the beginning of the string." (defun org-contacts-metadata-prefix (string collection predicate) '(metadata . - ((display-sort-function . org-contacts-display-sort-function)))) + ((cycle-sort-function . org-contacts-display-sort-function) + (display-sort-function . org-contacts-display-sort-function)))) (defun org-contacts-complete-group (start end string) "Complete text at START from a group. -- 1.8.1.2 --=-=-=--