emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Daimrod <daimrod@gmail.com>
To: Simon Campese <emacs-orgmode@campese.de>
Cc: emacs-orgmode@gnu.org
Subject: Re: [org-contacts] need help for making gnus/message-mode integration optional
Date: Wed, 27 Feb 2013 13:39:50 +0100	[thread overview]
Message-ID: <87ehg2lyll.fsf@tanger.home> (raw)
In-Reply-To: <87fw0ivfbc.fsf@tu-dortmund.de> (Simon Campese's message of "Wed, 27 Feb 2013 00:13:59 +0100")


[-- Attachment #1.1: Type: text/plain, Size: 1617 bytes --]

Simon Campese <emacs-orgmode@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,


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.2: 0001-org-contacts.el-Add-a-custom-variable-to-let-others-.patch --]
[-- Type: text/x-diff, Size: 2410 bytes --]

From 9eef3177dc401b49a902fcbcbdf86dc1d63865d8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Jadi?= <gregoire.jadi@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


[-- Attachment #1.3: Type: text/plain, Size: 21 bytes --]


-- 
Daimrod/Greg

[-- Attachment #2: Type: application/pgp-signature, Size: 835 bytes --]

      parent reply	other threads:[~2013-02-27 12:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-26 23:13 [org-contacts] need help for making gnus/message-mode integration optional Simon Campese
2013-02-27  8:36 ` Bastien
2013-02-27 12:39 ` Daimrod [this message]

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.orgmode.org/

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

  git send-email \
    --in-reply-to=87ehg2lyll.fsf@tanger.home \
    --to=daimrod@gmail.com \
    --cc=emacs-orgmode@campese.de \
    --cc=emacs-orgmode@gnu.org \
    /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/org-mode.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).