emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Daimrod <daimrod@gmail.com>
To: "Øyvind Stegard" <oyvinst@ifi.uio.no>
Cc: emacs-orgmode@gnu.org
Subject: Re: [PATCH] org-contacts: Provide ordering when using cycle completion
Date: Tue, 11 Jun 2013 20:45:27 +0200	[thread overview]
Message-ID: <87zjuwfpvc.fsf@tanger.home> (raw)
In-Reply-To: <87mwqy48ly.fsf.rednorrock@ifi.uio.no> ("Øyvind Stegard"'s message of "Mon, 10 Jun 2013 11:29:13 +0200")

[-- Attachment #1: Type: text/plain, Size: 2702 bytes --]

Øyvind Stegard <oyvinst@ifi.uio.no> 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,
>
> Øyvind Stegard
> -- 
> < Øyvind Stegard
>  < http://stegard.net/
>
>
> From 64623274f0a040c452df43b2a3f7b23b0af8fd57 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?=C3=98yvind=20Stegard?= <oyvind.stegard@ifi.uio.no>
> 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.

-- 
Daimrod/Greg

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 835 bytes --]

      reply	other threads:[~2013-06-11 18:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-10  9:29 [PATCH] org-contacts: Provide ordering when using cycle completion Øyvind Stegard
2013-06-11 18:45 ` Daimrod [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zjuwfpvc.fsf@tanger.home \
    --to=daimrod@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=oyvinst@ifi.uio.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).