From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel,gmane.emacs.orgmode 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> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1297536532 22379 80.91.229.12 (12 Feb 2011 18:48:52 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 12 Feb 2011 18:48:52 +0000 (UTC) Cc: emacs-orgmode@gnu.org, emacs-devel@gnu.org To: Stefan Monnier , Julien Danjou Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 12 19:48:47 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PoKWT-0007ug-4z for ged-emacs-devel@m.gmane.org; Sat, 12 Feb 2011 19:48:45 +0100 Original-Received: from localhost ([127.0.0.1]:55032 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PoKMn-0000WO-8b for ged-emacs-devel@m.gmane.org; Sat, 12 Feb 2011 13:38:45 -0500 Original-Received: from [140.186.70.92] (port=37219 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PoKM5-000062-6g for emacs-devel@gnu.org; Sat, 12 Feb 2011 13:38:02 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PoKM3-0002UR-OO for emacs-devel@gnu.org; Sat, 12 Feb 2011 13:38:01 -0500 Original-Received: from out1.smtp.messagingengine.com ([66.111.4.25]:45734) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PoKM3-0002UA-JN; Sat, 12 Feb 2011 13:37:59 -0500 Original-Received: from compute1.internal (compute1.nyi.mail.srv.osa [10.202.2.41]) by gateway1.messagingengine.com (Postfix) with ESMTP id 83AC820F44; Sat, 12 Feb 2011 13:37:58 -0500 (EST) Original-Received: from frontend1.messagingengine.com ([10.202.2.160]) by compute1.internal (MEProxy); Sat, 12 Feb 2011 13:37:58 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=from:to:cc:subject:references:date:in-reply-to:message-id:mime-version:content-type; s=smtpout; bh=d/Ua+c1QsyPXb19jK6/3kKwaddI=; b=XnoXloex3X4Wwr1sxz7e7EEK0PiKd3PEVtEJLLT6GaY0BJbKSWEhisZ6h8luqFg1lhKryPMEjwpU11O+SwLBITLUVNVXTBQXhl0F0KC6V/Yuy0EBEmIiJmm3BVXv9Dz1Nmug5jbg2XvkvLV1RX28DvHPgZeMNZBDWZrpXdY3z3s= X-Sasl-enc: FszQ1yQCfKRZ/ghpRX2XZFpAceEvqJ0dVYP2WuXdFe71 1297535878 Original-Received: from thinkpad (95-88-32-105-dynip.superkabel.de [95.88.32.105]) by mail.messagingengine.com (Postfix) with ESMTPA id 2D3C640CB24; Sat, 12 Feb 2011 13:37:56 -0500 (EST) In-Reply-To: (Stefan Monnier's message of "Fri, 11 Feb 2011 18:08:39 -0500") User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.111.4.25 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-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 Xref: news.gmane.org gmane.emacs.devel:135950 gmane.emacs.orgmode:37556 Archived-At: 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---