From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daimrod Subject: Re: [PATCH] org-contacts: Provide ordering when using cycle completion Date: Tue, 11 Jun 2013 20:45:27 +0200 Message-ID: <87zjuwfpvc.fsf@tanger.home> References: <87mwqy48ly.fsf.rednorrock@ifi.uio.no> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40216) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UmTW0-0005Jz-E7 for emacs-orgmode@gnu.org; Tue, 11 Jun 2013 14:42:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UmTVw-0003qQ-8q for emacs-orgmode@gnu.org; Tue, 11 Jun 2013 14:41:56 -0400 Received: from mail-ee0-x22b.google.com ([2a00:1450:4013:c00::22b]:50900) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UmTVv-0003q2-Vc for emacs-orgmode@gnu.org; Tue, 11 Jun 2013 14:41:52 -0400 Received: by mail-ee0-f43.google.com with SMTP id l10so3223091eei.16 for ; Tue, 11 Jun 2013 11:41:50 -0700 (PDT) In-Reply-To: <87mwqy48ly.fsf.rednorrock@ifi.uio.no> (=?utf-8?Q?=22=C3=98yv?= =?utf-8?Q?ind?= Stegard"'s message of "Mon, 10 Jun 2013 11:29:13 +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: =?utf-8?Q?=C3=98yvind?= Stegard Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable =C3=98yvind Stegard writes: > Hello list, Hello, Merged into master, thanks for patch! > 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/ > > > From 64623274f0a040c452df43b2a3f7b23b0af8fd57 Mon Sep 17 00:00:00 2001 > From: =3D?UTF-8?q?=3DC3=3D98yvind=3D20Stegard?=3D > Date: Mon, 10 Jun 2013 11:08:56 +0200 > Subject: [PATCH] org-contacts: Provide ordering when using cycle completi= on > > * 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 consiste= nt > 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= ." >=20=20 > (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)))) >=20=20 > (defun org-contacts-complete-group (start end string) > "Complete text at START from a group. =2D-=20 Daimrod/Greg --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (GNU/Linux) iQIcBAEBAgAGBQJRt3BNAAoJEBNzVHcrZRiUrZ0P/j2dnEjyisKWqHxkh4u5vMvO h13LpykG2bcfFqd7LVf2Nexj3CQQ0DuIfWxuja9u/Y8r5u08toxUpgvygKZontOI 4/bqXS69++4/oKCYI8T8ZhuMXU32QNqsPqbkgBsakKo8WMCOsUd0NIiknG+fAFfO 4Mve878JO2tXEkjXxPDpkzZgaX5XCW8GGAjXRAsLpOkbj7xUwv9mu/xb1QICo8dj xHkcwwgv41k6lPgbKjA81HY28gVaLbayhRmR7kkySysdFu57+NJEnQtqyJdwcyhr f0d9hOyWuDgJ+EqLPkqNr7rKghtJIlUaBoxQ95nztYhJhz2zUuLZKKtNGE0sbkQ2 pTle8EDOXbINaAxc3nSHCRZ2YI5Tvtok0KCO18VzXabLuKAZv6d0rbunTfac88W+ 31O3hILvQBIFMYR4drWozMDQUj1pMsAi4DIYodfi+Q9vGuk6NFEqsaEo3nHfF7+g kp7IhXztJLukm/yt0/izo/LIZgEZPjNDRf2FWi+/GvjEmgtxL1Jj0ShVAeOUtcJG MtwtN47dmq7FvwcFchw7pSzurTjJ0l7/p+bAsv6g0k/fp9wCqqZNKgFYRSEV+0tc bXnHabS3St7yZRYce+3p1Lav3LAEEuwMY2tsi67LCw/pdRWxFko2KF6gmrTH/LJL 9dt8kDlb96UxlnIGW7/5 =Odnw -----END PGP SIGNATURE----- --=-=-=--