From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: org-contacts email completion by tags Date: Wed, 4 Jun 2014 19:16:17 -0400 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=e89a8f234a39beddba04fb0ad071 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49361) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsKPs-0007Lj-Do for emacs-orgmode@gnu.org; Wed, 04 Jun 2014 19:16:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WsKPr-0001TW-7e for emacs-orgmode@gnu.org; Wed, 04 Jun 2014 19:16:20 -0400 Received: from mail-pb0-x22a.google.com ([2607:f8b0:400e:c01::22a]:35538) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsKPr-0001TI-0N for emacs-orgmode@gnu.org; Wed, 04 Jun 2014 19:16:19 -0400 Received: by mail-pb0-f42.google.com with SMTP id md12so189360pbc.1 for ; Wed, 04 Jun 2014 16:16:17 -0700 (PDT) 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: "emacs-orgmode@gnu.org" --e89a8f234a39beddba04fb0ad071 Content-Type: text/plain; charset=UTF-8 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. Thanks, 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 --e89a8f234a39beddba04fb0ad071 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi all,

I have setup org-= contacts and completion of emails in message mode. I have some contacts tha= t are tagged :group: and some tagged :group:ms:

If I put +grou= p 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 o= rg-contacts? That search works fine with C-c am.

Thanks,

John

-----------------= ------------------
John Kitchin
Associate Professor
Doherty Hall A207F
Department of = Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213<= br>412-268-7803
http://kitchingroup.cheme.cmu.edu

--e89a8f234a39beddba04fb0ad071-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daimrod Subject: Re: org-contacts email completion by tags Date: Thu, 05 Jun 2014 13:51:55 +0900 Message-ID: <87oay8ez6c.fsf@tanger.home> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50192) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsPeu-0005c2-OW for emacs-orgmode@gnu.org; Thu, 05 Jun 2014 00:52:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WsPep-000132-PY for emacs-orgmode@gnu.org; Thu, 05 Jun 2014 00:52:12 -0400 Received: from mail-pd0-x233.google.com ([2607:f8b0:400e:c02::233]:47622) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsPep-00012M-Hx for emacs-orgmode@gnu.org; Thu, 05 Jun 2014 00:52:07 -0400 Received: by mail-pd0-f179.google.com with SMTP id fp1so530334pdb.10 for ; Wed, 04 Jun 2014 21:52:06 -0700 (PDT) In-Reply-To: (John Kitchin's message of "Wed, 4 Jun 2014 19:16:17 -0400") 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: John Kitchin Cc: "emacs-orgmode@gnu.org" 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 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-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daimrod Subject: Re: org-contacts email completion by tags Date: Thu, 05 Jun 2014 20:50:40 +0900 Message-ID: <87bnu7fucv.fsf@tanger.home> References: <87oay8ez6c.fsf@tanger.home> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51268) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsWC3-0002h5-S1 for emacs-orgmode@gnu.org; Thu, 05 Jun 2014 07:50:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WsWBy-00019v-HM for emacs-orgmode@gnu.org; Thu, 05 Jun 2014 07:50:51 -0400 Received: from mail-pd0-x229.google.com ([2607:f8b0:400e:c02::229]:46966) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WsWBy-00019f-6c for emacs-orgmode@gnu.org; Thu, 05 Jun 2014 07:50:46 -0400 Received: by mail-pd0-f169.google.com with SMTP id w10so987321pde.14 for ; Thu, 05 Jun 2014 04:50:45 -0700 (PDT) In-Reply-To: (John Kitchin's message of "Thu, 5 Jun 2014 07:33:20 -0400") 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: John Kitchin Cc: "emacs-orgmode@gnu.org" John Kitchin writes: > 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 (interactive "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-only 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 look into this later today. Thanks > for the ideas. The completion for group based on tags is done in the function `org-contacts-complete-group'. It's been a long time since I played with the completion mechanism, so I don't remember exactly how it worked. Maybe you can replace the mapcar with your function, but it might a bit more tricky than that, especially to handle empty result. Thanks for your work :) Best, --=20 Daimrod/Greg 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 12:54:19 -0400 Message-ID: References: <87oay8ez6c.fsf@tanger.home> <87bnu7fucv.fsf@tanger.home> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=e89a8ff25378987dc604fb19981b Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60582) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wsavt-0004ah-Jr for emacs-orgmode@gnu.org; Thu, 05 Jun 2014 12:54:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wsavl-0006CO-Fl for emacs-orgmode@gnu.org; Thu, 05 Jun 2014 12:54:29 -0400 Received: from mail-pd0-x22e.google.com ([2607:f8b0:400e:c02::22e]:52606) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wsavl-0006Bk-4m for emacs-orgmode@gnu.org; Thu, 05 Jun 2014 12:54:21 -0400 Received: by mail-pd0-f174.google.com with SMTP id r10so1330638pdi.5 for ; Thu, 05 Jun 2014 09:54:20 -0700 (PDT) In-Reply-To: <87bnu7fucv.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" --e89a8ff25378987dc604fb19981b Content-Type: text/plain; charset=UTF-8 On Thu, Jun 5, 2014 at 7:50 AM, Daimrod wrote: > org-contacts-complete-group Here is a better function I think. It uses the builtin org-contacts database: (defun insert-emails-from-tags (tag-expression) "insert emails from org-contacts that match the tags expression. For example: group-phd will match entries tagged with group but not with phd." (interactive "sTags: ") (insert (mapconcat 'identity (loop for contact in (org-contacts-filter) for contact-name = (car contact) for email = (org-contacts-strip-link (car (org-contacts-split-property (or (cdr (assoc-string org-contacts-email-property (caddr contact))) "")))) for tags = (cdr (assoc "TAGS" (nth 2 contact))) for tags-list = (if tags (split-string (substring (cdr (assoc "TAGS" (nth 2 contact))) 1 -1) ":") '()) if (let ((todo-only nil)) (eval (cdr (org-make-tags-matcher tag-expression)))) collect (org-contacts-format-email contact-name email)) ","))) 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 --e89a8ff25378987dc604fb19981b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: base64 PGRpdiBkaXI9Imx0ciI+PGRpdiBjbGFzcz0iZ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Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: org-contacts email completion by tags Date: Fri, 06 Jun 2014 21:39:35 -0400 Message-ID: <8761kd7b1k.fsf@andrew.cmu.edu> References: <87oay8ez6c.fsf@tanger.home> <87bnu7fucv.fsf@tanger.home> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36574) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wt5bY-0006Fs-1j for emacs-orgmode@gnu.org; Fri, 06 Jun 2014 21:39:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wt5bP-0000Uy-5J for emacs-orgmode@gnu.org; Fri, 06 Jun 2014 21:39:31 -0400 Received: from mail-qa0-x22f.google.com ([2607:f8b0:400d:c00::22f]:35674) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wt5bO-0000Ud-VY for emacs-orgmode@gnu.org; Fri, 06 Jun 2014 21:39:23 -0400 Received: by mail-qa0-f47.google.com with SMTP id s7so5072599qap.6 for ; Fri, 06 Jun 2014 18:39:22 -0700 (PDT) In-Reply-To: (John Kitchin's message of "Thu, 5 Jun 2014 12:54:19 -0400") 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" Here is what I finally ended up with to allow completion with tag expressions. I did not figure out how to avoid overwriting an org-contacts function. I thought I could find the right hooks to use, but I could not figure it out. It is only a one line modification to the org-contacts function. This works for tag expressions, but I have not gotten it to work with properties. (defun org-contacts-complete-tags (start end tag-expression) "insert emails from org-contacts that match the tags expression. For example: group-phd will match entries tagged with group but not with phd." (let* ((completion-ignore-case org-contacts-completion-ignore-case) (group-completion-p t)) (let ((result (mapconcat 'identity (loop for contact in (org-contacts-db) for contact-name = (car contact) for email = (org-contacts-strip-link (car (org-contacts-split-property (or (cdr (assoc-string org-contacts-email-property (caddr contact))) "")))) for tags = (cdr (assoc "TAGS" (nth 2 contact))) for tags-list = (if tags (split-string (substring (cdr (assoc "TAGS" (nth 2 contact))) 1 -1) ":") '()) if (let ((todo-only nil)) (eval (cdr (org-make-tags-matcher tag-expression)))) collect (org-contacts-format-email contact-name email)) ","))) (when (not (string= "" result)) ;; return (start end function) (lexical-let* ((to-return result)) (list start end (lambda (string pred &optional to-ignore) to-return))))))) this is the function I overwrote in my init files: (defun org-contacts-message-complete-function (&optional start) "Function used in `completion-at-point-functions' in `message-mode'." ;; Avoid to complete in `post-command-hook'. (when completion-in-region-mode (remove-hook 'post-command-hook #'completion-in-region--postch)) (let ((mail-abbrev-mode-regexp "^\\(Resent-To\\|To\\|B?Cc\\|Reply-To\\|From\\|Mail-Followup-To\\|Mail-Copies-To\\|Disposition-Notification-To\\|Return-Receipt-To\\):")) (when (mail-abbrev-in-expansion-header-p) (lexical-let* ((end (point)) (start (or start (save-excursion (re-search-backward "\\(\\`\\|[\n:,]\\)[ \t]*") (goto-char (match-end 0)) (point)))) (string (buffer-substring start end))) (or ;; I added the next line (org-contacts-complete-tags start end string) (org-contacts-complete-group start end string) (org-contacts-complete-name start end string)))))) -- ----------------------------------- John Kitchin Professor Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 http://kitchingroup.cheme.cmu.edu From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daimrod Subject: Re: org-contacts email completion by tags Date: Tue, 17 Jun 2014 16:45:27 +0900 Message-ID: <87ha3kugh4.fsf@tanger.home> References: <87oay8ez6c.fsf@tanger.home> <87bnu7fucv.fsf@tanger.home> <8761kd7b1k.fsf@andrew.cmu.edu> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53478) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wwo5R-0000Hs-IU for emacs-orgmode@gnu.org; Tue, 17 Jun 2014 03:45:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wwo5H-0007XA-TT for emacs-orgmode@gnu.org; Tue, 17 Jun 2014 03:45:45 -0400 Received: from mail-pd0-x22f.google.com ([2607:f8b0:400e:c02::22f]:52828) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wwo5H-0007Wq-N3 for emacs-orgmode@gnu.org; Tue, 17 Jun 2014 03:45:35 -0400 Received: by mail-pd0-f175.google.com with SMTP id v10so4411644pde.6 for ; Tue, 17 Jun 2014 00:45:34 -0700 (PDT) In-Reply-To: <8761kd7b1k.fsf@andrew.cmu.edu> (John Kitchin's message of "Fri, 06 Jun 2014 21:39:35 -0400") 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: John Kitchin Cc: "emacs-orgmode@gnu.org" John Kitchin writes: Hi, First, sorry for the late reply. > Here is what I finally ended up with to allow completion with tag > expressions. I did not figure out how to avoid overwriting an > org-contacts function. I thought I could find the right hooks to use, > but I could not figure it out. It is only a one line modification to the > org-contacts function. I've added a new hook `org-contacts-complete-functions' that you can use to plug your function. > This works for tag expressions, but I have not > gotten it to work with properties. > > (defun org-contacts-complete-tags (start end tag-expression) > "insert emails from org-contacts that match the tags expression. For example: > group-phd will match entries tagged with group but not with phd." > (let* ((completion-ignore-case org-contacts-completion-ignore-case) > (group-completion-p t)) > (let ((result (mapconcat 'identity > (loop for contact in (org-contacts-db) > for contact-name = (car contact) > for email = (org-contacts-strip-link (car (org-contacts-split-property > (or > (cdr (assoc-string org-contacts-email-property > (caddr contact))) > "")))) > for tags = (cdr (assoc "TAGS" (nth 2 contact))) > for tags-list = (if tags > (split-string (substring (cdr (assoc "TAGS" (nth 2 contact))) 1 -1) ":") > '()) > if (let ((todo-only nil)) > (eval (cdr (org-make-tags-matcher tag-expression)))) > > collect (org-contacts-format-email contact-name email)) > ","))) > (when (not (string= "" result)) > ;; return (start end function) > (lexical-let* ((to-return result)) > (list start end > (lambda (string pred &optional to-ignore) to-return))))))) > Thanks, but I'm refactoring org-contacts a bit, and I think I have found a slightly better way to do that, but in the meantime you can use the aforementioned hook for your function. Best, -- Daimrod/Greg From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daimrod Subject: Re: org-contacts email completion by tags Date: Sun, 13 Jul 2014 19:48:14 +0900 Message-ID: <87vbr1r0up.fsf@tanger.home> References: <87oay8ez6c.fsf@tanger.home> <87bnu7fucv.fsf@tanger.home> <8761kd7b1k.fsf@andrew.cmu.edu> <87ha3kugh4.fsf@tanger.home> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55594) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X6HKY-0001JI-GW for emacs-orgmode@gnu.org; Sun, 13 Jul 2014 06:48:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X6HKP-00010r-Fn for emacs-orgmode@gnu.org; Sun, 13 Jul 2014 06:48:30 -0400 Received: from mail-pd0-x236.google.com ([2607:f8b0:400e:c02::236]:48013) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X6HKP-00010L-8d for emacs-orgmode@gnu.org; Sun, 13 Jul 2014 06:48:21 -0400 Received: by mail-pd0-f182.google.com with SMTP id fp1so874053pdb.13 for ; Sun, 13 Jul 2014 03:48:19 -0700 (PDT) In-Reply-To: <87ha3kugh4.fsf@tanger.home> (daimrod@gmail.com's message of "Tue, 17 Jun 2014 16:45:27 +0900") 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: John Kitchin Cc: "emacs-orgmode@gnu.org" Daimrod writes: > Thanks, but I'm refactoring org-contacts a bit, and I think I have found > a slightly better way to do that, but in the meantime you can use the > aforementioned hook for your function. It turns out that my idea was wrong, so I have used a version very similar to yours. The function is triggered by the prefix '#' (customizable) and can be used to match tags and properties. e.g. the following expression: #work-phd&BIRTHDAY<>"" will look for contacts with the tag 'work' but not the tag 'phd' and for which there is a BIRTHDAY properties. Best, -- Daimrod/Greg