unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tassilo@member.fsf.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>,
	Julien Danjou <julien@danjou.info>
Cc: emacs-orgmode@gnu.org, emacs-devel@gnu.org
Subject: Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org
Date: Sat, 12 Feb 2011 19:37:55 +0100	[thread overview]
Message-ID: <87zkq16qv0.fsf@member.fsf.org> (raw)
In-Reply-To: <jwvlj1mp41j.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Fri, 11 Feb 2011 18:08:39 -0500")

Stefan Monnier <monnier@iro.umontreal.ca> writes:

Hi Stefan & Julien,

>> Hm, why not simply add a property :ignore-case to the PROPS a
>> function in `completion-at-point-functions' may return in addition to
>> the existing :predicate and :annotation-function?
>
> That could work as well, but it's more complexity in
> completion-at-point, compared to completion-table-case-fold which can
> be added without touching any existing code.

You are right.  I've implemented and tested your approach, and it works
just fine.  Thanks a ton!

@Julien: Here's a patch for org-contacts.el which uses Stefan's
suggestion to fix the completion in the case-insensitive case.

Bye,
Tassilo

--8<---------------cut here---------------start------------->8---
From 4195d4cd3a63df06e52465e4519863ef2a7933e7 Mon Sep 17 00:00:00 2001
From: Tassilo Horn <tassilo@member.fsf.org>
Date: Sat, 12 Feb 2011 19:36:51 +0100
Subject: [PATCH] Fix case-insensitive completion

---
 org-contacts.el |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/org-contacts.el b/org-contacts.el
index 8513117..4c99ca9 100644
--- a/org-contacts.el
+++ b/org-contacts.el
@@ -114,6 +114,12 @@ If both match values are nil, return all contacts."
         (add-to-list 'result
                      (list (org-get-heading t) marker (org-entry-properties marker 'all)))))))
 
+(when (not (fboundp 'completion-table-case-fold))
+  ;; That function is new in Emacs 24...
+  (defun completion-table-case-fold (table string pred action)
+    (let ((completion-ignore-case t))
+      (complete-with-action action table string pred))))
+
 (defun org-contacts-complete-name (&optional start)
   "Complete text at START with a user name and email."
   (let* ((end (point))
@@ -167,7 +173,9 @@ If both match values are nil, return all contacts."
                                            ;; If the user has an email address, append USER <EMAIL>.
                                            if email collect (concat contact-name " <" email ">"))
                                      ", ")))))
-    (list start end completion-list)))
+    (list start end (if org-contacts-completion-ignore-case
+			(apply-partially #'completion-table-case-fold completion-list)
+		      completion-list))))
 
 (defun org-contacts-message-complete-function ()
   "Function used in `completion-at-point-functions' in `message-mode'."
-- 
1.7.4
--8<---------------cut here---------------end--------------->8---



  reply	other threads:[~2011-02-12 18:37 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87r5bhysp6.fsf@keller.adm.naquadah.org>
     [not found] ` <m1wrl8c5ix.fsf@94.197.191.21.threembb.co.uk>
     [not found]   ` <878vxovsym.fsf@keller.adm.naquadah.org>
     [not found]     ` <87k4h7ua23.fsf@member.fsf.org>
2011-02-10 16:56       ` Re: Announcing org-contacts, a bbdb-like contact manager for Org Julien Danjou
2011-02-10 18:20         ` Stefan Monnier
2011-02-11 10:21           ` [Orgmode] " Tassilo Horn
2011-02-11 14:47             ` Stefan Monnier
2011-02-11 20:15               ` Tassilo Horn
2011-02-11 23:08                 ` Stefan Monnier
2011-02-12 18:37                   ` Tassilo Horn [this message]
2011-02-20 16:58                     ` Julien Danjou
2011-03-18 15:00                   ` Completing with anything (was: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org) Julien Danjou
2011-03-18 18:16                     ` Completing with anything Stefan Monnier
2011-03-21 11:23                       ` Julien Danjou
2011-03-21 12:51                         ` Tassilo Horn
2011-03-21 13:36                           ` Julien Danjou
2011-03-21 14:17                             ` Tassilo Horn
2011-03-21 16:27                             ` Stefan Monnier
2011-03-21 16:55                               ` Dimitri Fontaine
2011-03-21 17:04                               ` Julien Danjou
2011-03-21 22:00                                 ` Stefan Monnier
2011-03-22 10:00                                 ` Aankhen
2011-03-22 11:57                                   ` [O] " Tassilo Horn
2011-03-22 12:03                                     ` Julien Danjou
2011-03-22 12:31                                       ` Tassilo Horn
2011-03-21 15:19                         ` Stefan Monnier
2011-03-21 15:54                           ` Julien Danjou
2011-04-09 15:11                             ` [O] " Julien Danjou
2011-04-10  4:03                               ` Stefan Monnier
2011-04-11  9:21                                 ` Julien Danjou
2011-04-12  3:42                                   ` Stefan Monnier
2011-04-12  9:48                                     ` Julien Danjou
2011-05-04 15:07                                       ` Stefan Monnier
2011-05-04 15:34                                         ` Julien Danjou
2011-05-24  3:14                                           ` Stefan Monnier
2011-05-24  7:33                                             ` Julien Danjou
2011-05-24  9:16                                             ` Antoine Levitt
2011-05-24 12:47                                               ` Stefan Monnier
2011-05-24 13:18                                                 ` Antoine Levitt
2011-05-24 14:04                                                   ` Stefan Monnier
2011-05-24 14:05                                                   ` Stefan Monnier
2011-05-24 14:45                                                     ` Antoine Levitt
2011-05-24 18:05                                                   ` Stefan Monnier
2011-05-24 18:30                                                     ` Antoine Levitt
2011-05-26  2:23                                                       ` Stefan Monnier
2011-05-26  7:50                                                         ` Antoine Levitt
2011-05-28  2:15                                                           ` Stefan Monnier
2011-02-11 11:08         ` Announcing org-contacts, a bbdb-like contact manager for Org Thierry Volpiatto

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.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87zkq16qv0.fsf@member.fsf.org \
    --to=tassilo@member.fsf.org \
    --cc=emacs-devel@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=julien@danjou.info \
    --cc=monnier@iro.umontreal.ca \
    /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.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).