From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tassilo Horn Subject: Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org Date: Sat, 12 Feb 2011 19:37:55 +0100 Message-ID: <87zkq16qv0.fsf@member.fsf.org> References: <87r5bhysp6.fsf@keller.adm.naquadah.org> <878vxovsym.fsf@keller.adm.naquadah.org> <87k4h7ua23.fsf@member.fsf.org> <87vd0romky.fsf@keller.adm.naquadah.org> <87mxm2na63.fsf@member.fsf.org> <87vd0qfhu3.fsf@member.fsf.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: In-Reply-To: (Stefan Monnier's message of "Fri, 11 Feb 2011 18:08:39 -0500") List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org To: Stefan Monnier , Julien Danjou Cc: emacs-orgmode@gnu.org, emacs-devel@gnu.org List-Id: emacs-orgmode.gnu.org Stefan Monnier 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 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 . 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---