From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: org-contacts email completion by tags Date: Thu, 5 Jun 2014 07:33:20 -0400 Message-ID: References: <87oay8ez6c.fsf@tanger.home> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a1135e624aed0a204fb151c6a Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35071) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsVvA-0007Qx-6q for emacs-orgmode@gnu.org; Thu, 05 Jun 2014 07:33:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WsVv8-0002G0-Md for emacs-orgmode@gnu.org; Thu, 05 Jun 2014 07:33:24 -0400 Received: from mail-pd0-x232.google.com ([2607:f8b0:400e:c02::232]:40305) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsVv8-0002En-A3 for emacs-orgmode@gnu.org; Thu, 05 Jun 2014 07:33:22 -0400 Received: by mail-pd0-f178.google.com with SMTP id v10so974089pde.9 for ; Thu, 05 Jun 2014 04:33:21 -0700 (PDT) In-Reply-To: <87oay8ez6c.fsf@tanger.home> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Daimrod Cc: "emacs-orgmode@gnu.org" --001a1135e624aed0a204fb151c6a Content-Type: text/plain; charset=UTF-8 neat idea. This code does exactly what I need for the completion for a whole tag query. It should be possible to integrate that into completion. (defun insert-emails-from-tags (tags) (interactive "sTags: ") (insert (save-window-excursion (find-file "contacts-bbdb.org") (mapconcat 'identity (let ((todo-only nil)) (org-scan-tags (lambda () (org-entry-get (point) "EMAIL")) ; action (cdr (org-make-tags-matcher tags)) ; matcher nil)) ", ")))) It should be possible to integrate this into the org-contacts database to get this with completion. I will look into this later today. Thanks for the ideas. John ----------------------------------- John Kitchin Associate Professor Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 http://kitchingroup.cheme.cmu.edu On Thu, Jun 5, 2014 at 12:51 AM, Daimrod wrote: > John Kitchin writes: > > > Hi all, > > > > I have setup org-contacts and completion of emails in message mode. I > have some contacts that are tagged :group: and some tagged :group:ms: > > > > If I put +group in the email To field, it completes to all of the > entries (awesome!) > > > > But +group-ms does not work. Is that a bug, or a known limit of > org-contacts? That search works fine with C-c am. > > An unknown limitation of org-contacts. ;) > > org-contacts doesn't use `org-tags-view', that's why it doesn't support > this match syntax. > > ATM, it is unclear to me how such syntax could be integrated with the > completion mechanism. > > Also, I haven't look at the code that handles this in org-mode so I > don't know how easy or hard it would be to use it with org-contacts. > > > An alternative would be to provide a way to store the addresses of > contacts in a sparse tree or in the *org-agenda* buffer. > > e.g. > C-x b contacts.org RET > C-c a m foo+bar RET > M-x org-contacts-copy-contacts RET > C-x b *Group* RET ;; Switch to Gnus > m ;; compose a message > C-c C-f ;; goto From > C-y > > WDYT? > > > Best, > -- > Daimrod/Greg > --001a1135e624aed0a204fb151c6a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
neat idea. This code does exactly what I need for the= completion for a whole tag query. It should be possible to integrate that = into completion.

(defun insert-emails-from-tags (tags)
=C2=A0 (i= nteractive "sTags: ")
=C2=A0 (insert
=C2=A0=C2=A0 (save-window-excursion
=C2=A0=C2=A0=C2=A0= =C2=A0 (find-file "contacts-bbdb.= org")
=C2=A0=C2=A0=C2=A0=C2=A0 (mapconcat
=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0 'identity
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (let ((todo-on= ly nil))
=C2=A0=C2=A0=C2=A0 (org-scan-tags
=C2=A0=C2=A0=C2=A0 =C2=A0(lambda ()
=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 (org= -entry-get (point) "EMAIL")) ; action
=C2=A0=C2=A0=C2=A0 =C2= =A0(cdr (org-make-tags-matcher tags)) ; matcher
=C2=A0=C2=A0=C2=A0 =C2= =A0nil)) ", "))))

It should be possible to integrate= this into the org-contacts database to get this with completion. I will lo= ok into this later today. Thanks for the ideas.



= John

-----------------------------------
John Kitchin
Associat= e Professor
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
http://kitchingr= oup.cheme.cmu.edu



On Thu, Jun 5, 2014 at 12:51 AM, Daimrod= <daimrod@gmail.com> wrote:
John Kitchin <jkitchin@andrew.cmu.edu> writes:

> Hi all,
>
> I have setup org-contacts and completion of emails in message mode. I = have some contacts that are tagged :group: and some tagged :group:ms:
>
> If I put +group in the email To field, it completes to all of the entr= ies (awesome!)
>
> But +group-ms does not work. Is that a bug, or a known limit of org-co= ntacts? That search works fine with C-c am.

An unknown limitation of org-contacts. ;)

org-contacts doesn't use `org-tags-view', that's why it doesn&#= 39;t support
this match syntax.

ATM, it is unclear to me how such syntax could be integrated with the
completion mechanism.

Also, I haven't look at the code that handles this in org-mode so I
don't know how easy or hard it would be to use it with org-contacts.

An alternative would be to provide a way to store the addresses of
contacts in a sparse tree or in the *org-agenda* buffer.

e.g.
C-x b contacts.org RE= T
C-c a m foo+bar RET
M-x org-contacts-copy-contacts RET
C-x b *Group* RET ;; Switch to Gnus
m =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; compose a mess= age
C-c C-f =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; goto From
C-y

WDYT?


Best,
--
Daimrod/Greg

--001a1135e624aed0a204fb151c6a--