Simon Campese <emacs-orgm...@campese.de> writes:

> Hello,

Hi Simon,

> I have one quick feature request for org-contacts.el that should be
> pretty easy and quick to implement: Could someone please introduce
> customizable variables to optionally disable the gnus/message mode
> integration?  

I've added a custom boolean, `org-contacts-enable-completion', that you
can set to nil to disable the `message-mode' integration.

Thanks for reporting this.

> I don't know a lot of elisp, so instead of copy-pasting my way to a
> half-baked solution that would maybe not be accepted upstream, I thought
> that asking the experts here is more appropriate.  
>
> My reason for this request:
> For email address completion in message mode, I use a program that scans
> through my whole email database (I use notmuch to manage emails and have
> all my mails stored locally). This program is stored in
> 'notmuch-address-command' and the integration has so far been done by
> 'notmuch-address'. However, the recent version of org-contacts breaks
> this behaviour, i.e. I only get the emails from my org-contacts file
> when I try to complete recipients. As I don't want to add all the people
> I correspond with electronically to my org-contacts file, this is a huge  
> annoyance.

Could you try the attached patch and set the variable
`org-contacts-complete-exclusive' to nil and see if it still happens.

With this patch org-contacts should fail silently to complete and let
other functions do the completion, so it should complete with both
org-contacts and notmuch.


Regards,

From 9eef3177dc401b49a902fcbcbdf86dc1d63865d8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Jadi?= <gregoire.j...@gmail.com>
Date: Wed, 27 Feb 2013 13:31:12 +0100
Subject: [PATCH] org-contacts.el: Add a custom variable to let others
 functions complete in `message-mode'

* contrib/lisp/org-contacts.el (org-contacts-complete-exclusive): a
  custom boolean variable to let others functions complete in
  `message-mode'.

(org-contacts-complete-group, org-contacts-complete-name): Use
`org-contacts-complete-exclusive'.
---
 contrib/lisp/org-contacts.el |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/contrib/lisp/org-contacts.el b/contrib/lisp/org-contacts.el
index 8674533..8189da2 100644
--- a/contrib/lisp/org-contacts.el
+++ b/contrib/lisp/org-contacts.el
@@ -138,6 +138,12 @@ This overrides `org-email-link-description-format' if set."
   :group 'org-contacts
   :type 'boolean)
 
+(defcustom org-contacts-complete-exclusive t
+  "Determine whether `org-contacts-message-complete-function'
+should be the only function to complete or not."
+  :group 'org-contacts
+  :type 'boolean)
+
 ;; Decalre external functions and variables
 (declare-function wl-summary-message-number "ext:wl-summary" ())
 (declare-function wl-address-header-extract-address "ext:wl-address")
@@ -421,7 +427,10 @@ A group FOO is composed of contacts with the tag FOO."
 				 ", ")))
 		;; We haven't found the correct group
 		(completion-table-case-fold completion-list
-					    (not org-contacts-completion-ignore-case))))))))
+					    (not org-contacts-completion-ignore-case)))
+	      :exclusive (if org-contacts-complete-exclusive
+			     'yes
+			   'no))))))
 
 (defun org-contacts-complete-name (start end string)
   "Complete text at START with a user name and email."
@@ -445,7 +454,10 @@ A group FOO is composed of contacts with the tag FOO."
 	    (org-contacts-make-collection-prefix
 	     (org-contacts-all-completions-prefix
 	      string
-	      (remove-duplicates completion-list :test #'equalp)))))))
+	      (remove-duplicates completion-list :test #'equalp)))
+	    :exclusive (if org-contacts-complete-exclusive
+			   'yes
+			 'no)))))
 
 (defun org-contacts-message-complete-function (&optional start)
   "Function used in `completion-at-point-functions' in `message-mode'."
-- 
1.7.10.4

-- 
Daimrod/Greg

Attachment: pgpJPNCKaneHS.pgp
Description: PGP signature

Reply via email to