[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager f
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 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) |
Stefan Monnier <address@hidden> 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 <address@hidden>
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---
- Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org, Julien Danjou, 2011/02/10
- Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org, Stefan Monnier, 2011/02/10
- Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org, Tassilo Horn, 2011/02/11
- Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org, Stefan Monnier, 2011/02/11
- Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org, Tassilo Horn, 2011/02/11
- Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org, Stefan Monnier, 2011/02/11
- Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org,
Tassilo Horn <=
- Re: [Orgmode] Re: Announcing org-contacts, a bbdb-like contact manager for Org, Julien Danjou, 2011/02/21